I've solved such situations frequently in the past, I did it the following way: instead of writing a for-loop with some fancy variable and string handling, I used a basic text editor with column mode (like Notepad++), and I made a list of files I wanted to rename:
img (1).jpg
img (2).jpg
img (3).jpg
img (4).jpg
Using the column mode, I copied the same column next to it, so I get:
img (1).jpg img (1).jpg
img (2).jpg img (2).jpg
img (3).jpg img (3).jpg
img (4).jpg img (4).jpg
Using a basic "Replace", I then altered the second column to what I wanted (replace " ("
by "_0"
and remove the closing brackets):
img (1).jpg img_01.jpg
img (2).jpg img_02.jpg
img (3).jpg img_03.jpg
img (4).jpg img_04.jpg
Again using the column mode, I added move
at the beginning of each line:
move "img (1).jpg" img_01.jpg
move "img (2).jpg" img_02.jpg
move "img (3).jpg" img_03.jpg
move "img (4).jpg" img_04.jpg
I put this into a batchfile, I tested some random lines in order to check if everything was done fine, and then I launched the whole thing.
Obviously, if you need to do this regularly, it might be better to have a more automated way of working, but if this is a "once-or-twice-in-a-lifetime", do it like this.