init
This commit is contained in:
commit
52512af151
29
LICENSE
Normal file
29
LICENSE
Normal file
@ -0,0 +1,29 @@
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2025, AlterWare
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
24
README.md
Normal file
24
README.md
Normal file
@ -0,0 +1,24 @@
|
||||
# IWD Archive Lister
|
||||
|
||||
This script scans the `main/` and `iw4x/` folders under a specified root directory for `.iwd` files (which are ZIP archives). For each `.iwd` file found, it extracts the list of files inside the archive using `7z` and writes the output to a `.txt` file in a folder called `out/`.
|
||||
|
||||
Each `.iwd` file gets its own `.txt` file in the `out/` directory, with the same base name (e.g., `iw_00.iwd` -> `out/iw_00.iwd.txt`).
|
||||
|
||||
## Requirements
|
||||
|
||||
- [`7z`](https://www.7-zip.org/) command-line tool
|
||||
|
||||
### Install 7z on Debian/Ubuntu:
|
||||
|
||||
```bash
|
||||
sudo apt update
|
||||
sudo apt install p7zip-full
|
||||
```
|
||||
|
||||
### Usage
|
||||
|
||||
```bash
|
||||
./script.sh <root_directory>
|
||||
```
|
||||
|
||||
Where `<root_directory>` is the path that contains both `main/` and `iw4x/` subfolders.
|
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"
|
Loading…
x
Reference in New Issue
Block a user