When exporting unmodified originals from Apple Photos the timestamps can be wrong. Sometimes this information is still available within the photo EXIF data, but sometimes you're not that lucky and the one and only date is wrong.
Info Apple Photos | Info Finder |
---|---|
This script fixes these cases by copying the time information from Apple Photos into the photo EXIF data.
Clone the project to your Desktop
git clone https://github.com/mvgijssel/apple-photos-export-timestamp-fix.git ~/Desktop/photofix
Export unmodified originals from Apple Photos and save into ~/Desktop/photofix/images/apple
cd ~/Desktop/photofix
./photofix apple ./images/apple --dest ./images/apple/final
NOTE: assuming the iCloud Photos library is located at ~/Pictures/Photos Library.photoslibrary
When exporting photos from Google Photos the timestamps are not preserved within the photo EXIF data, this data is provided in a "sidecar" json file.
Clone the project, for example to your Desktop
git clone https://github.com/mvgijssel/apple-photos-export-timestamp-fix.git ~/Desktop/photofix
Navigate into the installation directory
cd ~/Desktop/photofix
Install all the dependencies
brew install exiftool
bundle install
Export Google Photos using https://takeout.google.com/settings/takeout
Depending on the number of photos you have, the photos will need to be downloaded in multiple archives. Try to make the archives as large as possible (50GB), smaller archives can miss necessary json information.
Move all the .zip archives to a single folder: ~/Desktop/photofix/images/google
Navigate to the images folder
cd ~/Desktop/photofix/images/google
Unzip all the archives using the following command
for file in $(ls); do; echo "Processing $file"; unzip $file -d "unzip-$file"; done
Merge all the unzipped folders
mkdir merged
for folder in $(ls | grep "unzip-"); do; echo "Merging $folder"; cp -lR $folder/Takeout/Google\ Foto_s/* merged/; done
Remove the unzipped folders
for folder in $(ls | grep "unzip-"); do; echo "Removing $folder"; rm -rf $folder; done
Navigate to the installation directory
cd ~/Desktop/photofix
Run script to fix google photo timestamps and export to ~/Desktop/photofix/final
./photofix google ~/Desktop/photofix/images/google --dest ~/Desktop/photofix/google/final
dupeGuru
tool https://dupeguru.voltaicideas.netfind ~/Desktop/images -type d -empty -print -delete