From 5e7c9b7183cd51fb73280efce2849de08fa242ff Mon Sep 17 00:00:00 2001 From: Jonathan Hodgson Date: Sun, 15 Mar 2020 09:25:20 +0000 Subject: [PATCH] Tidy lanPortImages --- bin/.bin/images/lanPortImages | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/bin/.bin/images/lanPortImages b/bin/.bin/images/lanPortImages index 81c8181b..ffe90ab4 100755 --- a/bin/.bin/images/lanPortImages +++ b/bin/.bin/images/lanPortImages @@ -1,22 +1,16 @@ #!/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/ +for f in ./*.{jpg,jpeg,png,gif}; do + if [ -f "$f" ]; then + WIDTH=$(identify -format "%w" "$f")> /dev/null + HEIGHT=$(identify -format "%h" "$f")> /dev/null + if [[ "$HEIGHT" > "$WIDTH" ]]; then + mv "$f" portraits/ + else + 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