Tidy lanPortImages

Jonathan Hodgson 5 years ago
parent 0988d27e7a
commit 5e7c9b7183
  1. 26
      bin/.bin/images/lanPortImages

@ -1,22 +1,16 @@
#!/usr/bin/env bash #!/usr/bin/env bash
#
mkdir "portraits" mkdir "portraits"
mkdir "landscapes" mkdir "landscapes"
for f in ./*.jpg; do for f in ./*.{jpg,jpeg,png,gif}; do
WIDTH=$(identify -format "%w" "$f")> /dev/null if [ -f "$f" ]; then
HEIGHT=$(identify -format "%h" "$f")> /dev/null WIDTH=$(identify -format "%w" "$f")> /dev/null
echo "Width: $WIDTH" HEIGHT=$(identify -format "%h" "$f")> /dev/null
echo "Height: $HEIGHT" if [[ "$HEIGHT" > "$WIDTH" ]]; then
echo "" mv "$f" portraits/
if [[ "$HEIGHT" > "$WIDTH" ]]; then else
mv "$f" portraits/ mv "$f" landscapes/
else fi
mv "$f" landscapes/
fi 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 done

Loading…
Cancel
Save