I am trying to come up with a script to do the following but I do not have and Windows Coding experience.
I am trying to achieve the following:
I have a folder with multiple images in it and I want to rename it with a sequence like this
2012.000.value
Were value is I would like it to be able to enter a value before the script is run and the first image will be that number and then it will count up renaming that folder of images with that value.
Some images may have a file name called Original and I would like to retain that value but also insert the above sequence into the file name.
The images will be .jpg
The above code assumes the directories will be in the format of
%CurrentYear%.000.???. If you want multiple years, you’ll need different code.EDIT: This code will NOT output
000.jpgor001.jpg, it will output0.jpgor1.jpg. The code at the bottom will deal with that.Also it will completely drop the original file name for
###.jpgand will work with any value. If you want the original filename preserved like so#-FileName.jpgchange therenline to:The code will not sort the files, but will deal with them in the order that they were created in. If you want them alphabetized, then change the
for %%z in (%%x\*.jpg) do (line to:EDIT: This code will output numbers of consistent length, limited by user input.
To use this code, you need to pass it how many characters you want the maximum number to be. So…
…can rename the files from
00.jpgto99.jpgand……can rename the files from
0000.jpgto9999.jpg.IMG.BATI prefer this method, because Windows Explorer normally sorts files alphabetically, so this would be the file order of
1.jpg2.jpg3.jpg10.jpg20.jpgBut if those numbers are fixed at 3 characters width with leading 0’s, the alphabetical order of them would be: