Skip to content

Instantly share code, notes, and snippets.

@charliecm
Last active November 13, 2023 23:43
Show Gist options
  • Save charliecm/3562285d23b1ab4f57db to your computer and use it in GitHub Desktop.
Save charliecm/3562285d23b1ab4f57db to your computer and use it in GitHub Desktop.
Useful metadata editing and batch renaming snippets using exiftool.
# Changing metadata -----------------------------------------------------------
# Copy tags from one file to another
# http://thomer.com/howtos/copy_exif.html
exiftool -TagsFromFile a.jpg b.jpg
# Photos — change CreateDate metadata
exiftool "-CreateDate=2017:05:17 12:00:00" IMG.jpg
# Videos — change date to "Creation Date" (written by DSLRs)
exiftool -ext m4v -ext mp4 -ext mov "-CreationDate>CreateDate" -"CreationDate>FileCreateDate" "-CreationDate>FileModifyDate" "-CreationDate>ModifyDate" "-CreationDate>TrackCreationDate" "-CreationDate>TrackModifyDate" "-CreationDate>MediaCreationDate" "-CreationDate>MediaModifyDate" .
# Videos — change date to "Create Date" (written by iOS)
exiftool -ext m4v -ext mp4 -ext mov "-CreateDate>FileCreateDate" "-CreateDate>FileModifyDate" "-CreateDate>ModifyDate" "-CreateDate>TrackCreateDate" "-CreateDate>TrackModifyDate" "-CreateDate>MediaCreateDate" "-CreateDate>MediaModifyDate" .
# Batch renaming --------------------------------------------------------------
# Add -r to perform operations recursively (for subfolders)
# Photo — rename files to date (e.g., 2015-10-Oct-28-10-28-31.jpg)
# Replace -testname with -filename to confirm change
exiftool -ext jpg -ext png -d "%Y-%m-%b-%d-%H-%M-%S%%-c.%%e" "-testname<CreateDate" .
# Videos — rename files to date (e.g., 2015-10-Oct-28-10-28-31.m4v)
# Replace -testname with -filename to confirm change
exiftool -ext m4v -ext mp4 -ext mov -d "%Y-%m-%b-%d-%H-%M-%S%%-c.%%e" "-testname<CreateDate" .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment