I have to write a batch script to school, which moves all .jpg files from one folder to other one and rename them at the same time. I have a problem with for loop.
set i=1
for /R %folder1% %%F in (*.jpg) do (
move "%folder1%\%%F" "%folder2%\%newname%_%i%.jpg
set /a i+=1 )
Newname is a variable entered by user.
For example if I have files named file09.jpg, fvfdfv.jpg, whatever.jpg I need to rename them to %newname%_1.jpg, %newname%_2.jpg, %newname%_3.jpg.
My problem is, that it moves all files from folder1, but in folder2 there is just one file named newname_1.jpg ... Like if all files was moved to a single one..
Do you have any tips please?