Remove portrait images

⇠ Back to Blog:Hacks

This little script removes images which appear to be in the portrait format (tweak it for your own needs). #!/bin/bash

orientation=`exiftool -orientation "$1"` echo "$1" has $orientation; if ! [[ $orientation =~ "Horizontal" ]] then

   echo "so removed";
   rm "$1";

fi

You can run it recursively with: find directory/ -name "*.JPG" -exec ./rm-portrait {} \;