When uploading to an ftp site, the original file create date seems to be lost, and I get the upload date instead. However, the Exif data in the file is correct. Is there a tool to batch change the created date from the Exif date?

  • 1
    Please consider accepting the answer that you find the most helpful. This way, other people who search for this question will see it marked as "answered". It's also a way to reward a person who have spent their time helping you. – Dmitry Grigoryev Sep 17 '15 at 8:11

The EXIF handling tool exiv2 has a builtin option for this:

exiv2 -T rename image.jpg

sets the time of last file modification, mtime, to the date stored in the EXIF metadata.

You asked for using the create time - but that is not used in Unix-like systems - and there are good reasons for that: https://unix.stackexchange.com/questions/27297/why-doesnt-nix-keep-track-of-file-creation-time

I'm pretty sure the time you call create time is actually mtime - no problem there.

From man exiv2:

        exiv2 - Image metadata manipulation tool

        exiv2 [options] [action] file ...

        exiv2 is a program to read and write Exif, IPTC and XMP image metadata and image com‐
        ments. The following image formats are supported:

 [ ... ]

 mv | rename
       Rename files and/or set file timestamps according to the Exif create time‐
       stamp.  Uses  the  value  of  tag  Exif.Photo.DateTimeOriginal  or, if not
       present, Exif.Image.DateTime to determine the timestamp. The filename for‐
       mat can be set with -r fmt, timestamp options are -t and -T.

 [ ... ]

 -T     Only  set  the  file  timestamp according to the Exif create timestamp, do not
        rename the file (overrides -k). This option is only  used  with  the  'rename'
        action.  Note:  On Windows you may have to set the TZ environment variable for
        this option to work correctly.

See option -t to do the opposite.

If you install the exiftool from CPAN you can run the following script, assuming that all your files are in a directory called "all"

for i in all/*; do
    SPEC=`exiftool -t -s -d "%Y-%m-%d %H:%M:%S" -CreateDate "$i"`
    read X DATE <<<${SPEC}
    echo "$i:$DATE"
    touch -d "$DATE" "$i"

ExifTool can read and manipulate most EXIF information, including extracting the Date/Time Original or Create Data EXIF tags. You can use this information to rename the files or change their timestamps. For example:

find -name '*.jpg' | while read PIC; do
    DATE=$(exiftool -p '$DateTimeOriginal' $PIC |
    sed 's/[: ]//g')
    touch -t $(echo $DATE | sed 's/\(..$\)/\.\1/') $PIC

This will find all JPG files in the current directory and update the timestamps.

If you want to also give those files a name based on that date (this tends to come in handy) then also add mv -i $PIC $(dirname $PIC)/$DATE.jpg before the done line.

Assuming, as mentioned by 'Volker Siegel', that you probably mean mtime, I would simple use exiftools builtin function..


 $ exiftool "-DateTimeOriginal>FileModifyDate" test.jpg

this will take the "exif field "DateTimeOriginal" information and use it to set the filesystems modified date/time info of the file "test.jpg".


$ ls -la test.jpg
-rw-r-----@ 1 user  18329968  2432451 14 Out 17:57 test.jpg

$ exiftool -DateTimeOriginal test.jpg
Date/Time Original              : 2015:10:09 13:29:58

$ exiftool "-DateTimeOriginal>FileModifyDate" test.jpg
    1 image files updated

$ ls -la test.jpg
-rw-r-----@ 1 user  18329968  2432451  9 Out 13:29 test.jpg

It can also be made using jhead command:

$ jhead -ft file.jpg
  • For Jhead 3.0 the option is -dsft. -ft does the opposite. – Tesquin Crydd Nov 4 '16 at 12:28

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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