You are not logged in.
Pages: 1
Hello,
I have many photos in a folder, for example, the files are like:
IMG_0001.JPG
IMG_0053.JPG
IMG_0648.JPG
IMG_7850.JPG
......
My questions is, How can I batch rename them to
IMG_0002.JPG
IMG_0054.JPG
IMG_0649.JPG
IMG_7851.JPG
......
That is, add 1 to the number sequence in the file?
Thanks!!
Offline
Is it always 4 numbers between IMG_ and .JPG? What about IMG_9999.JPG ?
Offline
Yes, always 4 numbers.
For IMG_9999.JPG, I would hope it is renamed to IMG_0001.JPG. But that's maybe too much to ask for, so I'll rename it manually in that case.
Offline
Try this Pascal script
var
Number:string;
NewNumber:string;
prefix:string;
begin
Number:=copy(Filename,5,4);
prefix:=copy(Filename,1,4);
NewNumber:=Inttostr(StrToInt(Number)+1);
while (length(NewNumber)<4) do begin
NewNumber:='0'+NewNumber;
end;
Filename:= prefix + NewNumber + WideExtractFileExt(FileName);
end.
Offline
The script works perfectly! Thanks a lot for the help, TGB. You're a genius!
Merry Christmas
Offline
Pages: 1