Last active
December 12, 2015 02:18
-
-
Save iandexter/4697522 to your computer and use it in GitHub Desktop.
Date a photo using EXIF timestamp.
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
for img in *.JPG ; do | |
fn=$(basename ${img} .JPG); | |
convert ${fn}.JPG ${fn}.exif; | |
tstamp=$(strings ${fn}.exif | grep -E "^[0-9]{3}.*\:.*" | head -1 | sed 's/:/\//' | sed 's/:/\//'); | |
[[ -n "${tstamp}" ]] && tdate=$(date -d "${tstamp}" +"%d %b %Y %H:%M") || tdate=""; | |
if [[ -n "${tdate}" ]] ; then | |
touch -d "${tdate}" ${fn}.JPG; | |
status="Touched" | |
else | |
status=""; | |
fi | |
echo "${fn}.JPG ${tstamp} ${tdate} ${status}"; | |
rm -f ${fn}.exif; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment