Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm looking for a utility that batch/bulk modifies file datestamps (date-modified and/or date-created) to the second accuracy but does so in ascending incremental order, e.g.

File1 2012-04-18 10:21:01
File2 2012-04-18 10:21:02
File3 2012-04-18 10:21:03

I want to do this because I want to force Flickr to order uploaded photos in a certain sequence.

I would like this for Windows or Mac. I have Ubuntu as well so could consider that, as a secondary choice.

share|improve this question
What OS are you using? –  Paul Apr 19 '12 at 0:57
@Paul - Windows or Mac, I stated this in the question title but I didn't say which version. I run 7, XP and MacOs. Also Ubuntu, but would prefer Windows or Mac. –  therobyouknow Apr 19 '12 at 1:08
Ah yeah, didn't see it in the title, I have added the tags –  Paul Apr 19 '12 at 1:13
You want to change them to be incremental, but on what criteria? The name? –  Paul Apr 19 '12 at 1:15
Are you sure that Flickr doesn't use the EXIF data in the images themselves? –  Daniel Andersson Apr 20 '12 at 6:22

2 Answers 2

up vote 4 down vote accepted


  • works in Linux/Mac,
  • uses no artificial delays to create time spread, and
  • keeps the modification date close to the original (I often find these dates handy in other contexts).


while [ $# -gt 1 ]; do
    if ! [ "${2}" = "${REF}" ]; then
        touch -h -r "${REF}" -d "+${i} seconds" "${2}"

Just specify the files in wanted temporal order and it will use the timestamp of the first file as a base, and add one second incrementally to each of the following arguments.

If the reference file is given multiple times, it will retain it's original time (this is only to be able to do e.g. "retime 0001.jpg *" without changing the reference timestamp). If another file is given multiple times, it will get the last logical timestamp.

Without -h, touch will dereference symbolic links, which is most probably not wanted in this case (if you say "symbolic what-now?", then don't worry).

share|improve this answer
+1 Thanks @Daniel Andersson –  therobyouknow Apr 19 '12 at 8:32
Accepted @Daniel Anderson with thanks. The -h option is not available on CentOS Linux it seems - I get an error so I removed it. I know what symbolic links are but I wouldn't expect to be applying this script to those, it would be a defined list of images. –  therobyouknow Apr 23 '12 at 9:28
retime 3.jpg 2.jpg 1.jpg this gives time order 1.jpg,2.jpg,3.jpg –  zzapper Sep 18 '13 at 17:27
@zzapper: Are you sure? I just tested it, and it works as described in the post here (and I can't see how the reverse ordering would happen from the logic in the script). –  Daniel Andersson Sep 18 '13 at 20:15

Good Question although maybe Flickr should have any option for ordering the uploaded files.

For Windows i would suggest

Nirsoft Bulk File Changer

For Linux one could easily write a bash script and utilize the touch command to change multiple files.

The touch command is also available on Mac OS X, someone has written an automation task to do this but again this could be done on the terminal

for f in $FILES
  echo "Processing $f file..."
  touch $f 

This bash script will touch every file in ascending order. You could add a "sleep" to the script if you wanted each file to have a different second value.

user@computer:/tmp/data$ ls -l

total 9028
-rw-r--r-- 1 user user  428800 Apr 19 12:18 File1
-rw-r--r-- 1 user user 4338800 Apr 19 12:18 File2
-rw-r--r-- 1 user user 4438800 Apr 19 12:18 File3
-rwxrwxrwx 1 user user      78 Apr 19 12:18 fix.sh
share|improve this answer
+1 @Christopher Wilson does Nirsoft Bulk File Changer change the date stamp of the files in a defined increment ascending through out. From a quick look at the website my impression is that yes it does bulk date stamp modification but the modification is the same applied to all the files, rather than applying an ascending value throughout a batch as I describe in my question. –  therobyouknow Apr 19 '12 at 8:32
On many file systems (Ext4 comes to mind), the "last modified" and other time stamps are only kept at second precision as standard, so the above will in practice give all the files the exact same time stamp, which will return the Flickr selection back to file name order. The sleep 1 addition should suffice, but it will of course take a minute for every 60 files in the directory. –  Daniel Andersson Apr 20 '12 at 6:21

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.