moving pics into specific dated folders using exif

so i started taking pictures and realized that when i dumped all the pics off my cf card that it would just dump all the pics into one folder. so using exif (in gentoo “emerge media-gfx/exif”, from source: http://libexif.sourceforge.net/) i came up with a quick snippet using exif to move the pictures to the proper dated folder (dated according to when the pic was taken not dumped off card):

for X in *; 
do Y=`exif $X |grep origi |cut -d"|" -f2 |awk '{print $1}' |sed 's/:/_/g'`; 
cp $X $Y; 
done

just replace “cp $X $Y” accordingly. for me $Y is “~/pics/$Y”

«
»
  • to create those folders in format mm_dd_year i use :
    Y=`exif *.JPG | awk ‘/Date/&&/orig/{print $4}’ | cut -d\| -f 2 | uniq | awk ‘{gsub(/:/,” “);print $2″_”$3″_”$1|”sort”}’` ; mkdir $Y

    but that is assuming that you are running that snippet from inside the folder where the jpg’s are


Leave a Reply

Your email address will not be published. Required fields are marked *