Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I need a batch file to loop through a list of jpgs in a folder, & move them to folders created based on their file names in the following convention:
The folder names will be based on the first 8 characters of the file names, so 09-01556.A2.12.jpg would go in a folder called 09-01556.
I have the following so far which does the job nicely:
for /f %%F in ('dir/b/a-d *.jpg') do call :sub1 %%F
goto :eof:sub1
set name=%1
md %name:~0,8%
move %* %name:~0,8%
BUT I also need to take account of situations where a jpg file is moved to the destination and it already exists. In this case, I do not want to overwrite, but need to increment the file name whilst preserving the 'previously copied version
SO in the example above, if 09-01556.A2.12.jpg already exists in c:\mydir\09-01556, then the batch command would copy it as 09-01556.A2.12~1.jpgI am also looking to set this script running with some kind of user interface where it runs every 5sec or so with some kind of indicator to the user that it is running
Thanks

Quote:
SO in the example above, if 09-01556.A2.12.jpg already exists in c:\mydir\09-01556, then the batch command would copy it as 09-01556.A2.12~1.jpgdir %name:~0,8%\%* && ( move %* %name:~0,8%\%~n*~1%~x* ) || ( move %* %name:~0,8%)quote:
I am also looking to set this script running with some kind of user interface where it runs every 5sec or so with some kind of indicator to the user that it is runningtitle "waiting" ping -n 5 localhost >nul tile "running" %0

heh, double post maybe?????
i scroll down and looks for old thread that has not been answered. trying to make every thread at least had a response.
and this thread is one of them.

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |