init
This commit is contained in:
36
list-iwd.sh
Executable file
36
list-iwd.sh
Executable file
@ -0,0 +1,36 @@
|
||||
#!/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"
|
Reference in New Issue
Block a user