Advertisement
Guest User

Untitled

a guest
Feb 26th, 2015
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.90 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3.  
  4. echo 'This is the list of images to delete. The format is path - width x height.'
  5. for file in "$1"*.{jpg,png}; do
  6.         if [[ -f "$file" ]]; then
  7.                 width=$(identify -format %w\\n "$file" -quiet)
  8.                 height=$(identify -format %h\\n "$file" -quiet)
  9.                 should_be_height1=$((($width/16)*9))
  10.                 should_be_height2=$((($width/16)*10))
  11.                 if [ "$should_be_height1" -ne "$height" -a "$should_be_height2" -ne "$height" ]; then
  12.                         echo $file - $width'x'$height
  13.                         echo $file >> .temporal
  14.                 fi
  15.         fi
  16. done
  17.  
  18. echo 'Do you want to delete them? YES/no'
  19. read response
  20. if [ $response = 'YES' ]; then
  21.         while read line; do
  22.                 echo rm $line
  23.         done < .temporal
  24.         rm .temporal
  25. else
  26.         echo 'OK man, your files are still there! :)'
  27. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement