You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
492 B

#!/usr/bin/env bash
mkdir "portraits"
mkdir "landscapes"
for f in ./*.jpg; do
WIDTH=$(identify -format "%w" "$f")> /dev/null
HEIGHT=$(identify -format "%h" "$f")> /dev/null
echo "Width: $WIDTH"
echo "Height: $HEIGHT"
echo ""
if [[ "$HEIGHT" > "$WIDTH" ]]; then
mv "$f" portraits/
else
mv "$f" landscapes/
fi
#if file "$f" 2>&1 | awk '/w =/{w=$5+0; h=$7+0; if (h>w) exit; else exit 1}'
#then
# mv "$f" portraits/
#else
# mv "$f" landscapes/
#fi
done