Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I look at the properties of an image, I can see the date the photo was taken in "Date Taken". When I edit the images (proprietary program) this data gets lost.

How can I rename the image files before editing to include this date (preferably in ISO format for sorting by name).

share|improve this question
up vote 11 down vote accepted

You can do this with exiftool. From the man page:

   exiftool '-FileName<CreateDate' -d %Y%m%d_%H%M%S%%-c.%%e dir
        Rename all images in "dir" according to the "CreateDate" date and
        time, adding a copy number with leading '-' if the file already
        exists ("%-c"), and preserving the original file extension (%e).
        Note the extra '%' necessary to escape the filename codes (%c and
        %e) in the date format string.

The example format should get you ISO format filenames. Include the time to make sure you can handle multiple images per day.

share|improve this answer
See also jhead – Stéphane Chazelas Jan 23 '14 at 12:13

The exiv2 tool can rename files using the timestamps:

from man exiv2:

mv | rename

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

so the following might do what you want:

exiv2 mv *.JPG
share|improve this answer

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.