I am trying to create a batch script to rename downloaded files. After downloading, the files have similar names that include a timestamp. The timestamps in the name differ from the value of the "last modified" timestamp (typically by only a few seconds). For example:
Export_2013_11_06_15_13_31.csv
Export_2013_11_06_15_13_41.csv
Export_2013_11_06_15_13_51.csv
etc.
Each of these files needs to be renamed to a SPECIFIC name in alphabetical order according to their last modified timestamp (not the timestamp in the name). The most recent file must be named Bart.csv
, the next Carol.csv
, and the oldest June.csv
.
Is there a way to ensure the files are renamed in the correct order?
dir /o
flag and options. Something likedir /a-d /b /o-d
– David Ruhmanndir
command typedir /?
on the command line. The line I posted will list only files/a-d
(no directories), remove formatting/b
, and sort the files in descending date order/o-d
(newest first). This can then be combined with afor /f
loop and theren
command. – David Ruhmann