Skip to content

Instantly share code, notes, and snippets.

@wsaribeiro
Forked from charliecm/exiftool-snippets.bash
Created November 13, 2023 23:43
Show Gist options
  • Save wsaribeiro/4a1f4d6d89244f51849f8fae8fb46a2a to your computer and use it in GitHub Desktop.
Save wsaribeiro/4a1f4d6d89244f51849f8fae8fb46a2a 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