Skip to content

Instantly share code, notes, and snippets.

@navasvarela
Created August 17, 2011 12:57
Show Gist options
  • Save navasvarela/1151482 to your computer and use it in GitHub Desktop.
Save navasvarela/1151482 to your computer and use it in GitHub Desktop.
Shell script to classify pictures according to month taken
#!/bin/bash
FILES=`find . -iregex '.*JPG'`
for file in $FILES
do
lastmod=`exiftool $file | grep 'Create Date' | awk '{print $4}' | sed 's/:/-/g'| sort | uniq`
echo "$file, Last Modification Date: $lastmod-"
month=`date --date="$lastmod" "+%B%Y"`
if [ ! -d $month ];then
mkdir $month
fi
cp $file $month
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment