I want to number files based on creation date rather than based on the old file names.
Example: Assume the following files are listed in descending order of creation date.
A.jpg
D.jpg
B.jpg
C.jpg
I want to rename these files such that
A.jpg becomes 4.jpg
D.jpg becomes 3.jpg
B.jpg becomes 2.jpg
C.jpg becomes 1.jpg
I am using Windows 8 and have sorted the files in the folder based on creation date. However, when I try to rename files, DOS ignores the sorting and proceeds to rename files based on old file names.
Thus,
A.jpg becomes 1.jpg
D.jpg becomes 4.jpg
B.jpg becomes 2.jpg
C.jpg becomes 3.jpg
I am using the following code (.bat file) which I got from a different post in this Website.
@Echo Off
setLocal EnableDelayedExpansion
set oldext=jpg
set newext=jpg
set index=0
for %%f IN (*.%oldext%) do (
set /A index+=1
set index=!index!
ren "%%f" "!index!.%newext%"
)
I do not have any scripting tools installed and am only creating basic .bat files using notepad.
Thanks for your help.