Skip to content

Instantly share code, notes, and snippets.

@sh78
Last active May 16, 2018 00:40
Show Gist options
  • Save sh78/84a758916bf81114a3ad9530aff8930d to your computer and use it in GitHub Desktop.
Save sh78/84a758916bf81114a3ad9530aff8930d to your computer and use it in GitHub Desktop.
# tested on macOS 10.13.4
# file system created time
## make sure developer tools are installed with `xcode-select --install`
## time format: MM/DD/YYYY HH:MM:SS
SetFile -d "12/01/2002 00:00:00" *.jpg
# file system modified date
## (sometimes recognized by Google Photos as date taken)
## time format: [CC]YYMMDDhhmm[ss]
touch -mt200212010000 *.jpg
# fix videos with mismatched exif dates
## sometimes videos have additional exifs that aren't right, esp. from
## legacy recording devices
## easy fix with `exiftool` is to correct the filesystem's modified date (above)
## and use it to write other Media exif tags that may exist
exiftool -s file.mp4
# => list of all exifs. find the offending date tags here
exiftool "-FileModifyDate>MediaCreateDate" file.mp4
## Google Photos uses MediaCreateDate as the date taken for videos
## other common exifs are `ModifyDate`, `TrackCreateDate`, `TrackModifyDate`,
## vice-versa, maybe the Media exif is correct but file system isn't (more likely)
exiftool "-MediaCreateDate>FileModifyDate" file.mp4
# location
## easiest way is:
# - import to Photos.app
# - select all, open Inspect pane
# - "assign a location"
# - export selected photos
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment