How to loop through folders and rename extensions in a batch file?

Posted on


Selecting a single folder I could run

ren *.jpeg *.png

I have multiple folders. I want to create a batch file that will loop through all the folders and will rename the files within it.

For example I have folders TEST1 and TEST2 inside root directory TEST. I want to create a batch that will rename all the .jpeg files within TEST1 and TEST2 to .png.

FOR /R "E:TEST" %%G in (*.jpeg) DO ren *.jpeg *.png


Leave a Reply

Your email address will not be published.