#!/bin/sh # v. 2.4 by Nick 11/8/2017 forcefix="n" if(test $1 = "-f") # with this option, tags are overwritten then forcefix="y" shift fi fatto="n" for i do if(test -e $i) then date=`exiftool -q -T -createdate $i` if(test "$forcefix" = "y" -o "$date" = "-") then # echo "quii " $i upcased=`echo $i | sed 's/jpg/JPG/'` rawfile=`echo $i | sed 's/jpg/CR2/'` upcaseds=`echo $upcased | sed 's/\([0-9]\)[-_].*\./\1./'` rawfiles=`echo $rawfile | sed 's/\([0-9]\)[-_].*\./\1./'` for j in $upcaseds $rawfiles do if(test -e $j) then exiftool -tagsFromFile $j $i echo $i took tags from $j mv $i"_original" /tmp fatto="y" fi done else echo $i" has correct tags: use option -f to force overwrite" fi else echo $i" not found" fi done if(test $fatto = "y") then echo "Moved _original files out of the way in /tmp" fi