I have a bunch of filenames that are timestamped (down to the nanoseconds) and I only want to keep one file per second. For example, here are some file names:
11-14-29-033.jpg
(which means that the file was recorded at 11th hour 14th minute 29th second and 33rd nanosecond).
11-14-29-602.jpg
11-14-29-839.jpg
11-14-29-953.jpg
11-14-30-406.jpg
11-14-30-847.jpg
11-14-31-091.jpg
11-14-31-419.jpg
11-14-31-667.jpg
11-14-32-364.jpg
11-14-32-619.jpg
11-14-32-913.jpg
11-14-33-150.jpg
11-14-33-485.jpg
11-14-33-708.jpg
11-14-34-052.jpg
11-14-34-336.jpg
11-14-35-174.jpg
11-14-36-563.jpg
11-14-36-788.jpg
11-14-37-278.jpg
11-14-37-584.jpg
11-14-38-050.jpg
11-14-38-841.jpg
11-14-39-196.jpg
11-14-39-736.jpg
11-14-39-870.jpg
11-14-40-091.jpg
11-14-40-766.jpg
11-14-41-052.jpg
11-14-41-676.jpg
Is there a way that I can write a batch file (in Windows) to remove all but 1 file per each second?
for
, use a sorted output ofdir
. In the loop, save first 8 letters of a filename. When it comes again => delete, else => save new prefix.