Skip to content

Instantly share code, notes, and snippets.

@zhasm
Created March 3, 2012 12:59
Show Gist options
  • Save zhasm/1965949 to your computer and use it in GitHub Desktop.
Save zhasm/1965949 to your computer and use it in GitHub Desktop.
auto classify images by reading exif date infor
#!/bin/bash
function getMonth(){
img="$1"
date=`identify -format "%[EXIF:DateTime]" $img |awk -F: '{print $1$2}'`
echo $date
}
mkdir -p misc
for i in `ls *jpg |head -n 1000`
do
date=`getMonth $i`
if [ ! -z "$date" ]; then
if [ ! -d $date ]; then
mkdir $date
fi
mv $i $date
else
mv $i misc/
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment