I have a lot of pictures with the wrong creation date and wrong modification date. There is however a third date, "content created" that is correct. user3439894 had this command line as an answer to Change file creation date to modification date using terminal

for f in *.[iI][mM][gG]; do m="$(GetFileInfo -m "$f")"; SetFile -m "$m" -d "$m" "$f"; done

Where GetFileInfo reads the modified date and rewrites the created date. Very useful and works great (after installing the command line tools) for a lot of my pictures that have the correct modification date, thanks. What I am looking for now, is a syntax for "content created" date that I could use?

Any help on this would be great.

Update: The easiest is probably to install EXIFTOOL. This simple command line in terminal did the job. To set “Date Created” to time from EXIF’s “DateTimeOriginal”: exiftool "-FileModifyDate<DateTimeOriginal" *

to move time by X hours ahead you can do: exiftool "-DateTimeOriginal-=1" *


Using tools that are part of macOS, We start by getting the ContentCreationDate from the file and place it into a container ccd -

ccd=$(mdls -raw -n kMDItemContentCreationDate FILE)

Next, We format the ContentCreationDate string into a string usable by SetFile and place that into a container nct -

nct=$(date -f '%F %T %z' -j "$ccd" '+%D %T %z')

Finally, We use SetFile and set the FSCreationDate to the modified date/time string from ContentCreationDate -

SetFile -d "$nct" FILE

I'm assuming that you know how to place all of this into a loop for processing multiple files.

Note: Look into exiftool

  • Smart, here’s how to do the core part, well done and super clear answer. – bmike Aug 2 '20 at 8:50
  • 1
    Thanks a lot! I am a bit of a novice in Terminal, but followed up you advice on exiftool, which proved to be very good! this simple line did the job: exiftool "-FileModifyDate<DateTimeOriginal" * – Arne Crogh Aug 2 '20 at 14:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .