Created
October 28, 2024 16:55
-
-
Save fehlfarbe/45e78208b3ce07d1d8490117ac9f2931 to your computer and use it in GitHub Desktop.
Delete all jpg files smaller than 1000x1000
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| find . -name "*.jpg" -type f -print0 | while read -d $'\0' file | |
| do | |
| #echo "$file" | |
| # get resolution via jhead | |
| res=$(jhead "$file" 2>/dev/null | grep Resolution) | |
| # extract x and y resolution | |
| x=$(echo $res | awk '{print $3}') | |
| y=$(echo $res | awk '{print $5}') | |
| # | |
| if (( $x < 1000 && $y < 1000 )) | |
| then | |
| echo "delete ${file} (${x}x${y})" | |
| # rm "${file}" | |
| fi | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment