Skip to content
Snippets Groups Projects
Commit 397a4e7f authored by David Rouquet's avatar David Rouquet
Browse files

new script to extract media folder including swf contents

parent 74d2a757
No related branches found
No related tags found
1 merge request!4Main
#!/bin/bash
# Check if the input and output folders are provided as arguments
if [ $# -lt 2 ]; then
echo "Usage: $0 <input_folder> <output_folder>"
exit 1
fi
# Get the input and output folder paths
input_folder="$1"
output_folder="$2"
# Ensure the input folder exists
if [ ! -d "$input_folder" ]; then
echo "Error: Input folder '$input_folder' does not exist."
exit 1
fi
# Create the output folder if it doesn't exist
mkdir -p "$output_folder"
# Loop through all files in the input folder
for file in "$input_folder"/*; do
# Skip if no files are found
if [ ! -e "$file" ]; then
echo "No files found in the input folder."
exit 0
fi
# Check if the file is an SWF file
if [[ "$file" == *.swf ]]; then
# Get the base name without extension
base_name=$(basename "$file" .swf)
# Create a subfolder for the extracted files
subfolder="${output_folder}/${base_name}"
mkdir -p "$subfolder"
# Extract assets using swfextract into the subfolder
echo "Processing SWF file: $file"
swfextract --outputformat "${subfolder}/${base_name}_%02d.%s" -a 1- "$file"
else
# Copy other files directly to the output folder
echo "Copying non-SWF file: $file"
cp "$file" "$output_folder/"
fi
done
echo "All files processed! SWF files are extracted and others are copied to '$output_folder'."
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment