Skip to content

Instantly share code, notes, and snippets.

@Philmod
Created October 8, 2018 21:30
Show Gist options
  • Save Philmod/7e9212c37074e49ca44668d30e7d9311 to your computer and use it in GitHub Desktop.
Save Philmod/7e9212c37074e49ca44668d30e7d9311 to your computer and use it in GitHub Desktop.
Script to redate pictures using offset
#!/bin/bash
for f in DSC_*.*; do
ts="$(GetFileInfo -d "$f")"
e="$(date -j -f "%m/%d/%Y %H:%M:%S" "$ts" +%s)"
((o=304730220))
((e+=o))
nd="$(date -r $e "+%m/%d/%Y %H:%M:%S")"
echo "$nd"
SetFile -m "$nd" "$f"
SetFile -d "$nd" "$f"
exiftool "-AllDates<FILE:FileModifyDate" -overwrite_original $f
SetFile -m "$nd" "$f"
SetFile -d "$nd" "$f"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment