Files
image_processing/zip_images_resize_recursive.sh
T

19 lines
444 B
Bash
Executable File

#!/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 in ZIPs recursively in $SEARCH_DIR"
find "$SEARCH_DIR" -iname '*.zip' -printf '%s\t%p\0' | \
sort -z -t$'\t' -k1,1rn | \
while IFS=$'\t' read -r -d '' _size f; do
"$SCRIPT_DIR/zip_images_resize.sh" "$f"
done