Replace file/folder names in Windows
This solution was also introduced in
-
CPPD-55Getting issue details...
STATUS
Sample Command
for /D /r %x in (1*Initial*Posting) do (ren "%x" 1-Pre-Advertisement)
- Loop the current directory, and find all the files/folders with name "1*Initial*Posting"
- Replace the file/folder "1*Initial*Posting" with a new name "1-Pre-Advertisement"
- There are two wildcards in DOS:
* = matches up with any combination of allowable characters
? = matches up with any single allowable character
- No space is allowed in a file/folder name
Therefore the commend can also be modified being more specific as:
for /D /r %x in (1-Initial?Posting) do (ren "%x" 1-Pre-Advertisement)
or
for /D /r %x in (1?Initial?Posting) do (ren "%x" 1-Pre-Advertisement)
Reference
https://www.ahuka.com/?page_id=31