Skip to content

Instantly share code, notes, and snippets.

@cbismuth
Last active June 5, 2023 16:55
Show Gist options
  • Save cbismuth/354dc2dc1d1c866602ee11a946afb34e to your computer and use it in GitHub Desktop.
Save cbismuth/354dc2dc1d1c866602ee11a946afb34e to your computer and use it in GitHub Desktop.
ExifTool command line to cleanup picture folders
#!/usr/bin/env bash
set -e
set -u
export INPUT_DIR="${BACKUP_HOME}/pictures/#sync/incoming"
export OUTPUT_DIR="${BACKUP_HOME}/pictures/#sync/timestamps"
export REMOTE_DIR="/Volumes/NAS/cloud/Pictures/timestamps"
echo "fudpes ..."
fdupes --recurse --noempty --nohidden --delete --noprompt ${INPUT_DIR}
echo "exiftool ..."
# The last valid assignment supersedes the others
# https://exiftool.org/forum/index.php/topic,5079.msg24483.html#msg24483
exiftool -progress -r -d "${OUTPUT_DIR}/%Y/%m/%Y%m%d%H%M%S%%-c.%%ue" "-filename<filemodifydate" "-filename<createdate" "-filename<datetimeoriginal" ${INPUT_DIR}
echo "rsync ..."
rsync -avzh --progress --stats --update "${OUTPUT_DIR}/2023/" "${REMOTE_DIR}/2023/"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment