How to keep photo date when dragging photos out of Photos app into a folder on Mac? [duplicate]
I have some photos taken in 2012 and when I export them as originals to a folder they have a creation date of July 2016. Running an EXIF detailer showed the images to have been taken in 2012, so why does Photos export them and add another date to it?
I tried exporting my whole album from 2009-2016 and noticed some pictures taken in years prior to 2016 to appear in July or other months of this year as well.
I would really appreciate if someone can shed some light on this issue.
Solution 1:
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.
Solution 2:
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
Solution 3:
Like the case of apple icloud photos, when you have all the information in the EXIF details, like you already know.
To restore all the dates information I followed this steps
-
Download exiftool
-
Run next command to fix the dates in all the files inside the folder(recursively)
exiftool -r '-FileModifyDate<DateTimeOriginal' "hereYourDirName"
-
Run next command to fix the dates in MOV files inside the folder(recursively)
exiftool -r '-FileModifyDate<CreationDate' "hereYourDirName/*.mov"
-
If you have the No writable tags... error, this probably means that you don't have the permission, so you can fix the owner and the permission with these command
sudo chown -R yourSessionUser directoryName sudo chmod -R 775 directoryName
This will restore all the dates. I hope that this information be useful
Now some other helping commands
To can check if your file has all the EXIF information you can check it with this command. Useful to be sure that you have the DateTimeOriginal with the right date.
exiftool -a -s -G directoryName
If you want to update the EXIF just on some extensions, for example just photos, you can use this commands. Useful if you have a los of mov files or files without the EXIF information, like this you will skip them, you will not have a warning and the exiftool will finish faster.
-
Generate the file called filesToUpdate.txt with the list of files that you want to update.
find hereTheAbsolutePathToTheFolder/* -type f | grep -E '\.(jpg|jpeg|png|heic|JPG|JPEG|PNG|HEIC)$' > filesToUpdate.txt
The list of jpg|jpeg|png|heic|JPG|JPEG|PNG|HEIC, is the list of extensions that you want to consider.
-
Now the command to run all this files is like this:
exiftool '-FileModifyDate<DateTimeOriginal' -@ filesToUpdate.txt
This command is to check which extensions files you have in a folder. Useful to check which extensions you want to include in previous command.
find hereThePathToTheFolderThat/* -type f | perl -ne 'print $1 if m/\.([^.\/]+)$/' | sort -u
Solution 4:
The accepted answer assumes one knows how to use the command line. If you do not, here are the assumed precursor steps:
1) Install a package manager, if you don't have one installed already. (And then use it forever to install new software :))
(Recommended:)
For Mac: use Homebrew - https://brew.sh/
For Windows: use Chocolatey - https://chocolatey.org/
2) Using your (^^ newly installed) package manager, install exiftool
, which is free software for viewing/working with media metadata:
On Mac:
brew install exiftool
On Windows:
choco install exiftool
3) Navigate to the directory containing your image/movie files by using the 'change directory' command: cd
- (Read more about how to use the command line here: https://www.digitalcitizen.life/command-prompt-how-use-basic-commands)
cd {insert-name-of-your-file-directory-here}
4) The last command is based on the above accepted answer(s), but I found that I needed to switch this to CreationDate
for it to actually reflect the original photos'/videos' capture date. And I also opted for using touch
:
One-liner version (copy and paste this):
for file in *; do touch -t "$(exiftool -p '$CreationDate' -d '%Y%m%d%H%M' "$file")" "$file"; done
(Same code, but formatted for readability in case you want to understand what is happening):
for file in *; do \
touch -t "$(exiftool -p '$CreationDate' -d '%Y%m%d%H%M' "$file")" "$file"; \
done
Solution 5:
I have just came across this post while trying to export all item of a Photos library to then re-import them in another one to consolidate all I have in one library. Using the default export unmodified original options, I realized that some items lose the "date taken" and so when re-imported they appears as if they are created today with the result of having all disorganized. I realized that most of those items are movies and stuff acquired from whatsapp. Looks like Photos has some metadata about those items that is not exporting in EXIF metadata. I solved all of this using this fantastic python tool:
- https://github.com/RhetTbull/osxphotos
It has many parameters to properly configure the export. Most usefull "--exiftool " that store exif information into the exported items.