Skip to content

Instantly share code, notes, and snippets.

@d4kine
Last active November 20, 2022 12:29
Show Gist options
  • Save d4kine/3c10a89e77fa9d7b8f8110f0b0ae8aa9 to your computer and use it in GitHub Desktop.
Save d4kine/3c10a89e77fa9d7b8f8110f0b0ae8aa9 to your computer and use it in GitHub Desktop.
EXIF dates minus one hour and preserve original modify date (tested on MacOSX only)
#!/bin/bash
FILE_LIST=$(find . -type f -iname "*.jpg" -o -iname "*.jpeg" -o -iname "*.raw" -o -iname "*.arw" | sort)
if [[ "${#FILE_LIST[@]}" == 0 ]]; then
echo "No files of found with type: (*.jpg|*.jpeg|*.raw|*.arw)"
exit 1
fi
for f in $FILE_LIST; do
echo "PROCESSING $f"
ORIGIN_DATE=$(stat -f %SB -t %Y-%m-%dT%H:%M:%S $f)
exiftool -AllDates-="0:0:0 1:0:0" $f
touch -d "$ORIGIN_DATE" $f
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment