Skip to content

Instantly share code, notes, and snippets.

@drguildo
Last active August 17, 2022 19:22
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drguildo/43a46d7d18de53e57a5f6f1b53ee5e37 to your computer and use it in GitHub Desktop.
Save drguildo/43a46d7d18de53e57a5f6f1b53ee5e37 to your computer and use it in GitHub Desktop.
A batch file for automatically renaming and organising images and videos into folders by date.
REM Use exiftool -s <filename> to list the tag names available for a file
REM Google Photos uses these if it doesn't find any metadata (and it doesn't do
REM a good job of looking).
exiftool "-FileCreateDate<DateTimeOriginal" "-FileModifyDate<DateTimeOriginal" *.*
exiftool "-Directory<DateTimeOriginal" -d "%%Y/%%B" *.jpg *.mp4 *.mts *.m2ts *.mov
exiftool "-Directory<CreateDate" -d "%%Y/%%B" *.jpg *.mp4 *.mts *.m2ts *.mov
exiftool "-Directory<CreationDate" -d "%%Y/%%B" *.wmv
REM Fallbacks in case we failed to match any metadata
exiftool "-Directory<FileCreateDate" -d "%%Y/%%B" *.jpg *.mp4 *.mts *.m2ts *.mov *.wmv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment