#!/bin/bash SEARCH_DIR="${1:-.}" SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" if [ ! -d "$SEARCH_DIR" ]; then echo "Error: '$SEARCH_DIR' is not a directory" exit 1 fi echo "Resizing images recursively in $SEARCH_DIR" find "$SEARCH_DIR" -mindepth 1 -type d -print0 | while IFS= read -r -d '' f do if pushd "$f" > /dev/null; then "$SCRIPT_DIR/images_resize.sh" popd > /dev/null else echo "Error: Failed to change to directory $f" fi done