(If this is in the wrong spot I'll unreservedly apologize, I wasn't sure where to put this)
A quick little bit of background, an old friend of mine uploaded pics of our trip way back when. I'd like to download these, but, unfortunately, he decided to upload all the pics simply named foto. Downloading them and renaming them by hand got old really quick (there are a lot of pics), so I decided to try my hand at a batch file where I could drop the pic on the file and it'd rename it sequentially (001,002,etc) only to remember that I know exactly nothing about batch files.
After spending a couple of hours putting together pieces of other scripts (and likely horrifying anyone that knows anything about cmd or batch files) the most I got working was that the batch file would take the number from an external file to use as the new filename, and adding +1 to the number and writing it back to the external file. The copying the file and renaming part would not work at all.
So what I'd like to ask is if someone could help me with a batch script that would enable me to:
-drop a pic on the batch file
-copy it to the folder the batch file is in
-have it take a number from an external .txt file
-add the necessary number of zeroes to it to make it three digits long
-rename the pic to 00X, etc
-increase the number in the external .txt file by one
-???
-profit?
I'll ad what I've pieced together (read stolen from other scripts and mashed in to some Frankenstein esque monstrosity) in the spoiler.
If anyone can help me I'd be really grateful because doing this manually is murder on my hand (the fact that I'm using a stylus rather than a traditional mouse isn't helping matters either).
A quick little bit of background, an old friend of mine uploaded pics of our trip way back when. I'd like to download these, but, unfortunately, he decided to upload all the pics simply named foto. Downloading them and renaming them by hand got old really quick (there are a lot of pics), so I decided to try my hand at a batch file where I could drop the pic on the file and it'd rename it sequentially (001,002,etc) only to remember that I know exactly nothing about batch files.
After spending a couple of hours putting together pieces of other scripts (and likely horrifying anyone that knows anything about cmd or batch files) the most I got working was that the batch file would take the number from an external file to use as the new filename, and adding +1 to the number and writing it back to the external file. The copying the file and renaming part would not work at all.
So what I'd like to ask is if someone could help me with a batch script that would enable me to:
-drop a pic on the batch file
-copy it to the folder the batch file is in
-have it take a number from an external .txt file
-add the necessary number of zeroes to it to make it three digits long
-rename the pic to 00X, etc
-increase the number in the external .txt file by one
-???
-profit?
I'll ad what I've pieced together (read stolen from other scripts and mashed in to some Frankenstein esque monstrosity) in the spoiler.
@Echo off
:start
cls
cd /d G:
set /p pnumber=<number.txt
set "num=%pnumber:~-3%"
echo "%~1"
copy "%1" "%CD%" /Y /S
ren "%CD%\*.jpg" "%CD%\%num%.jpg"
set /a number=%pnumber%+1
echo %number% >number.txt
exit
:start
cls
cd /d G:
set /p pnumber=<number.txt
set "num=%pnumber:~-3%"
echo "%~1"
copy "%1" "%CD%" /Y /S
ren "%CD%\*.jpg" "%CD%\%num%.jpg"
set /a number=%pnumber%+1
echo %number% >number.txt
exit