Skip to content

Instantly share code, notes, and snippets.

@fehlfarbe
Created October 28, 2024 16:55
Show Gist options
  • Select an option

  • Save fehlfarbe/45e78208b3ce07d1d8490117ac9f2931 to your computer and use it in GitHub Desktop.

Select an option

Save fehlfarbe/45e78208b3ce07d1d8490117ac9f2931 to your computer and use it in GitHub Desktop.
Delete all jpg files smaller than 1000x1000
#!/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