Make scripts generic and fix several bugs
- Add optional directory argument to images_resize_recursive.sh, zip_images_resize_recursive.sh, and new rar2zip_recursive.sh - Remove hardcoded-path wrappers rar2zip_images.sh and rar2zip_incomplete.sh - Fix zip_images_resize.sh: move SCRIPT_DIR to top, change exit 1 to continue on bad output file so remaining files still process - Use MAX_PIXELS variable in images_resize.sh resize argument - Fix zip_images_recursive.sh: replace case-sensitive 7z globs with find -iregex piped via xargs
This commit is contained in:
Executable
+21
@@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Recursively find all RAR files in a directory and convert them to ZIP.
|
||||
#
|
||||
# Usage: rar2zip_recursive.sh [directory]
|
||||
# directory Directory to search (default: current directory)
|
||||
|
||||
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 "Converting RARs to ZIPs in $SEARCH_DIR"
|
||||
|
||||
find "$SEARCH_DIR" -name '*.rar' -print0 | while IFS= read -r -d '' f
|
||||
do
|
||||
"$SCRIPT_DIR/rar2zip.sh" "$f"
|
||||
done
|
||||
Reference in New Issue
Block a user