diff --git a/sortbyorientation.sh b/sortbyorientation.sh new file mode 100644 index 0000000..ce99b3d --- /dev/null +++ b/sortbyorientation.sh @@ -0,0 +1,53 @@ +#!/bin/bash + +mkdir portraits +mkdir landscapes + +jhead -autorot *.jpg +jhead -autorot *.JPG +jhead -autorot *.png +jhead -autorot *.PNG + +for f in ./*.JPG +do + r=$(identify -format '%[fx:(h>w)]' "$f") + if [[ r -eq 1 ]] + then + mv "$f" portraits + else + mv "$f" landscapes + fi +done + +for f in ./*.jpg +do + r=$(identify -format '%[fx:(h>w)]' "$f") + if [[ r -eq 1 ]] + then + mv "$f" portraits + else + mv "$f" landscapes + fi +done + +for f in ./*.png +do + r=$(identify -format '%[fx:(h>w)]' "$f") + if [[ r -eq 1 ]] + then + mv "$f" portraits + else + mv "$f" landscapes + fi +done + +for f in ./*.PNG +do + r=$(identify -format '%[fx:(h>w)]' "$f") + if [[ r -eq 1 ]] + then + mv "$f" portraits + else + mv "$f" landscapes + fi +done \ No newline at end of file