Last active
August 14, 2017 18:19
-
-
Save Jofkos/ec4d0120e4fbe447ace42f82dca18766 to your computer and use it in GitHub Desktop.
Fixes the date from exported photos. (Sets the file-system date to the recording date from exif data)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Run in folder containing the pictures | |
for file in * | |
do | |
if [[ $(file --mime-type -b "${file}") == image/* ]] | |
then | |
touch -t "$(exiftool -createdate $file | awk -F ':| +' '{ print $5$6$7$8$9"."$10 }')" $file; | |
fi | |
done |
Or here as one-line command (run in directory containing the pictures):
for file in *; do if [[ $(file --mime-type -b "${file}") == image/* ]]; then touch -t "$(exiftool -createdate $file | awk -F ':| +' '{ print $5$6$7$8$9"."$10 }')" $file; fi done
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To use when exporting files with macOS' "Photos".