I have many files that I would like to reorder the name of.
Currently the file names read as
XXX-YYYYY-ZZZ-A1B2C3
I would like to reorder A1B2C3 to ABC123.
XXX-YYYYY-ZZZ-ABC123
The XYZ portion of the string will be variable lengths for each file, the A1B2C3 will always be at the end of the string.
Being able to batch over all files in the current folder is a good starting point, and batching over all files in the current folder and all subdirectories would be even better.
Any help is much appreciated!
Output example:
Some points about this code:
Your description say nothing about file extension so I assumed that the files have one. If not, just remove the
%%~Xf
part in the ECHO ren command.The last command just show in the screen the REN commands. If the REN commands looks correct, remove the ECHO part in order to execute the REN. You may also duplicate this line in order to see the REN commands when they are executed.
To also process all subdirectories, add /S switch in DIR command this way:
dir /A-D /B /S *.*
If you have also other files that don't needs renaming, you may select just these files changing the
*.*
wild-card in DIR command by*-*-*-*.*