Tidy lanPortImages

master
Jonathan Hodgson 5 years ago
parent cc5af36858
commit c4fbb912ba
  1. 14
      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
if [ -f "$f" ]; then
WIDTH=$(identify -format "%w" "$f")> /dev/null WIDTH=$(identify -format "%w" "$f")> /dev/null
HEIGHT=$(identify -format "%h" "$f")> /dev/null HEIGHT=$(identify -format "%h" "$f")> /dev/null
echo "Width: $WIDTH"
echo "Height: $HEIGHT"
echo ""
if [[ "$HEIGHT" > "$WIDTH" ]]; then if [[ "$HEIGHT" > "$WIDTH" ]]; then
mv "$f" portraits/ mv "$f" portraits/
else else
mv "$f" landscapes/ 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}' fi
#then
# mv "$f" portraits/
#else
# mv "$f" landscapes/
#fi
done done

Loading…
Cancel
Save