Skip to content

Instantly share code, notes, and snippets.

@gamunu
Last active December 11, 2021 08:30
Show Gist options
  • Save gamunu/7119595660280b5965a977f179b9e2b2 to your computer and use it in GitHub Desktop.
Save gamunu/7119595660280b5965a977f179b9e2b2 to your computer and use it in GitHub Desktop.
Move all files with low resolution to backup location
function mvImgBySize
{
minX=128
miny=96
xres=`identify -format "%[fx:w]" "$1"`
yres=`identify -format "%[fx:h]" "$1"`
if [ $xres -lt $minX ] || [ $yres -lt $minY ]
then
mv "$1" /path/to/backup/location/
fi
}
export -f mvImgBySize
find /path/to/basedir/with/pictures/ -iname "*.png" -o -iname "*.jpg" -o -iname "*.jpeg" -o -iname "*.resOriginalRes" -o -name "*.HEIC" -exec bash -c 'mvImgBySize "$0"' "{}" \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment