Skip to content

Instantly share code, notes, and snippets.

@blast-hardcheese
Forked from cfflymolo/recurse_image_resize
Last active December 24, 2015 01:29
Show Gist options
  • Save blast-hardcheese/6724405 to your computer and use it in GitHub Desktop.
Save blast-hardcheese/6724405 to your computer and use it in GitHub Desktop.
recurse_image_resize() {
for f in "$@"; do
if [ ! -d "$f" ]; then
echo "recurse_image_resize: '$f' is not a directory"
fi
for ff in "$f"/*.png; do
echo "resizing $ff to half size"
convert "$ff" -resize 50% "$ff";
done
for dir in "$f/*/"; do
if [ -d "$dir" ]; then # If there are no subdirectories, glob won't expand. Test just to be sure.
recurse_image_resize "$dir"
fi
done
done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment