Skip to content

Instantly share code, notes, and snippets.

@dmpop
Created July 11, 2016 07:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dmpop/e599faf75edcba6c4a896a95e4846853 to your computer and use it in GitHub Desktop.
Save dmpop/e599faf75edcba6c4a896a95e4846853 to your computer and use it in GitHub Desktop.
Helper script for using ExifTool
#!/bin/bash
#OPTIND=1
while getopts "h?sdyar" opt; do
case $opt in
s) exiftool -directory=%e .
;;
d) exiftool -d %Y%m%d-%H%M%S.%%e '-FileName<DateTimeOriginal' -r .
;;
y) exiftool '-Directory<CreateDate' -d %Y-%m-%d -r .
;;
a) exiftool -T -r -filename -make -model -fnumber -exposuretime -iso -r . > results.txt
;;
r) exiftool -overwrite_original -all= -r .
;;
h|\?)
cat <<EOF
USAGE:
$0 [OPTIONS]
$0 -s sort photos into folders by file extension
$0 -d rename photos by date
$0 -y sort photos into folders by year, month, and date
$0 -a save key EXIF data in the results.txt file
$0 -r remove all EXIF metadata from photos
EOF
exit 2
;;
esac
done
#shift $((OPTIND-1))
#[ "$1" = "--" ] && shift
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment