Skip to content

Instantly share code, notes, and snippets.

@yutsuku
Created February 22, 2019 19:45
Show Gist options
  • Save yutsuku/baf2ea1d93676b5a2ebb55c7a735c789 to your computer and use it in GitHub Desktop.
Save yutsuku/baf2ea1d93676b5a2ebb55c7a735c789 to your computer and use it in GitHub Desktop.
Sort your camera photos quickly
# COPY all files with missing EXIF [date taken] in current folder and
# subfolders to YYYY/MM/YYYYMMDD-HHMMSS.extension
# and writes EXIF [date taken] to file modified date
#
# Flags explanation:
#
# -o when combined with '-d' flag, forces copy operation,
# alone just specifiec output folder
# -P Preserve file dates
# -r recursive
# -if logical statement for operation
#
# Arguments explanation
#
# 'not $DateTimeOriginal'
# checks if file does not contain EXIF Creat date
# '-FileName<FileModifyDate'
# use file modified date as file name
# '-DateTimeOriginal<FileModifyDate'
# write EXIF Create date tag using file modified date
exiftool -o . -P -progress -r -if 'not $DateTimeOriginal' '-FileName<FileModifyDate' '-DateTimeOriginal<FileModifyDate' -d "%Y/%m/%Y%m%d-%H%M%S%%-c.%%e" .
# COPY all files in current folder and subfolders to YYYY/MM/YYYYMMDD-HHMMSS.extension
# and changes Date Created to date taken from EXIF info
exiftool -o . -P -r '-FileName<DateTimeOriginal' '-FileCreateDate<DateTimeOriginal' -d "%Y/%m/%Y%m%d-%H%M%S%%-c.%%e" .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment