Quantcast
Channel: Amagob IT Blog
Viewing all articles
Browse latest Browse all 13

Exiftool bash scripting

$
0
0

bash

With piles of photos dumped over the years on CDs and DVDs, I needed to organize them back on a Disk drive for ease of access and sharing with family. This little script reads the exif info on the JPG files in the current folder and subfolders and move them (with their paths) under a folder named the year it was taken. (The year is assumed and provided as an argument). All in Linux of course..

ex. ./organizephotos 2005

#/bin/bash

year=$1 
x=0
for f in `find . -name "*.JPG"`; do
((x++))

echo $x
#echo "mv $f ./$year${f#*.}"
nf=./$year${f#*.}
#echo `dirname $nf`

 if [ -n "`exiftool -DateTimeOriginal $f | grep $year`" ]; then

  if [ ! -d `dirname $nf` ]; then 
	echo "Creating path `dirname $nf`"
 	mkdir -p `dirname $nf`
  fi 
 	mv $f `dirname $nf`
  fi

done


Viewing all articles
Browse latest Browse all 13

Trending Articles