Skip to content

Instantly share code, notes, and snippets.

@jnx
Forked from jmuspratt/mediaName
Created February 23, 2021 07:49
Show Gist options
  • Select an option

  • Save jnx/5d0655e6f40416b2b984018fe2e7b2c3 to your computer and use it in GitHub Desktop.

Select an option

Save jnx/5d0655e6f40416b2b984018fe2e7b2c3 to your computer and use it in GitHub Desktop.
exiftool : rename files in current dir to YYYY-MM-DD-HH-MM-SS-1.ext
# Rename JPG, CR2, and MOV files according to EXIF capture date in YYYY-MM-DD-HH-MM-SS
format.
# Files shot within the same second get copy number added (-1,-2, etc.).
# Since iPhone video files appear to use GMT in CreateDate instead of local time,
# we extract MediaModifyDate instead of CreateDate.
# References:
# http://www.sno.phy.queensu.ca/~phil/exiftool/
# http://ninedegreesbelow.com/photography/exiftool-commands.html#rename
# http://www.polaine.com/2015/01/fixing-photo-and-video-file-metadata-with-exiftool/
exiftool -ext CR2 '-filename<CreateDate' -d %Y-%m-%d-%H-%M-%S%%-c.%%le .; exiftool -ext JPG '-filename<CreateDate' -d %Y-%m-%d-%H-%M-%S%%-c.%%le .; exiftool -ext MOV '-filename<MediaModifyDate' -d %Y-%m-%d-%H-%M-%S%%-c.%%le .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment