Export from Mac Photos app while keeping date created data?
Note that, in order for your files to have a created date that matches the EXIF "photo taken" date, you must use Export Unmodified Originals. Modified images may have been edited within Photos which results in a new file being created, and using the normal Export will export that modified file with the later creation date.
There are some options in this post on Photography SE for changing a file's creation date to match EXIF data. You should never attempt to use these on files within the .photoslibrary
bundle! Export your files first.
ExifTool is a very powerful command-line application for reading and writing EXIF data in a variety of files, including videos. However, on Macs, it cannot write the file creation date. There's a way around that using a bit of bash scripting.
Here's a command that will work for both photo and video files:
for file in *; do SetFile -d "$(exiftool -p '$CreateDate' -d '%m/%d/%Y %H:%M:%S' "$file")" "$file"; done
Essentially a loop is run over files in the current directory. exiftool
is used to read the EXIF creation date tag, and SetFile
is used to write as the file's creation date. The way it is written, it will affect all files in the current directory, so I suggest you move all files that you wanted modified into a directory with nothing else in it, and run the command from that directory.
in case you would like to use touch instead of SetFile:
for file in *; do touch -mt "$(exiftool -p '$CreateDate' -d '%Y%m%d%H%M.%S' "$file")" "$file"; done