|
Answer» Of 1434 .jpg files, all named "Picture [number]" how can I increment all of the files after the 230th by one? Such that "Picture 231" becomes "Picture 232" and so on.
Sorry to ask such an amateur question, but I have no experience with .bat files and this needs to be done fairly quickly, while the prospect of renaming each file myself is somewhat less then attractive considering their number.Probably the quickest way is to put the list of files into a text file :
dir /b /o-n > mylist.bat
This gives you a sorted (reverse order) list of files, delete (from the list) all those entries from the first you dont want to CHANGE until the bottom
Using the rectangular blocking facility of your editor (or Word) copy all the filenames and PASTE them at the end of the line, one line down -- eg
before
"picture 234.jpg" "picture 233.jpg" "picture 232.jpg" "picture 231.jpg"
after
"picture 234.jpg" "picture 233.jpg" "picture 234.jpg" "picture 232.jpg" "picture 233.jpg" "picture 231.jpg" "picture 232.jpg"
now paste in REN and a space at the start of each line and manually add in the first new filename
Like this
REN "picture 234.jpg" "picture new.jpg" REN "picture 233.jpg" "picture 234.jpg" REN "picture 232.jpg" "picture 233.jpg" REN "picture 231.jpg" "picture 232.jpg"
You see by doing it in reverse order, files are renamed out of the way first
GrahamQuote Sorry to ask such an amateur question, but I have no experience with .bat files and this needs to be done fairly quickly, while the prospect of renaming each file myself is somewhat less then attractive considering their number.
More IMPORTANTLY is your OS. Microsoft usually adds UTILITIES and batch code facilities with each new release. Without knowing your OS we have no idea what functions are AVAILABLE on your machine.
This may work:
Code: [Select]@echo off setlocal enabledelayedexpansion for /l %%v in (1434, -1, 231) do ( set /a w=%%v+1 ren "picture %%v.jpg" "picture !w!.jpg" )
Ah my bad. It's Windows XP - Media Edition I believe. I'll go try that out now.
|