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
I am getting an error:
The system can not find the file specified
I don't understand the issue.
Best Answer
You are not applying the
for
command to theren
action.You need to change
%%
to%
if you are doing this interactively, and not in a batch file.The
~
strips quotes, which are re-added, to avoid any possible errors with paths which contain spaces.