Last active
October 4, 2018 19:26
-
-
Save t3knoid/506ca498828f604592cdd89072922076 to your computer and use it in GitHub Desktop.
One-liner to batch rename same named folders or files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The following DOS batch one liner will rename many same-named folder folders. | |
The following example will rename folders under "Reports Test 2\data" that ends with "Custodian1" and renames it to "Custodian2." | |
for /f "tokens=*" %a in ('dir /b /s "Reports Test 2\data" ^| findstr /r "Custodian1$"') do ren "%a" "Custodian2" | |
This can be easily customized for example to rename folders or files in the current folder: | |
for /f "tokens=*" %a in ('dir /b') do ren "%~na" "%~na2" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment