#!/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