37 lines
807 B
Bash
Executable File
37 lines
807 B
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
|
|
SEVENZIP_BIN="${SEVENZIP_BIN:-7z}"
|
|
|
|
if [[ $# -ne 1 ]]; then
|
|
echo "Usage: $0 <root_folder>"
|
|
exit 1
|
|
fi
|
|
|
|
ROOT_DIR="$1"
|
|
MAIN_DIR="$ROOT_DIR/main"
|
|
IW4X_DIR="$ROOT_DIR/iw4x"
|
|
|
|
OUT_DIR="out"
|
|
|
|
if [[ ! -d "$MAIN_DIR" || ! -d "$IW4X_DIR" ]]; then
|
|
echo "Error: '$MAIN_DIR' or '$IW4X_DIR' directory not found."
|
|
exit 1
|
|
fi
|
|
|
|
mkdir -p "$OUT_DIR"
|
|
|
|
process_iwd_files() {
|
|
local folder="$1"
|
|
find "$folder" -type f -iname '*.iwd' | while read -r iwd_file; do
|
|
# Output text file in same dir with same basename
|
|
base_name="$(basename "$iwd_file")"
|
|
output_file="$OUT_DIR/${base_name}.txt"
|
|
echo "Processing $iwd_file -> $output_file"
|
|
"$SEVENZIP_BIN" l -ba "$iwd_file" | grep -oP '(?<=^.{53}).*' > "$output_file"
|
|
done
|
|
}
|
|
|
|
process_iwd_files "$MAIN_DIR"
|
|
process_iwd_files "$IW4X_DIR"
|