3

swftools are a unique set of tools but lack some user friendliness. They can't even iterate over provided objects:

Only one file allowed. You supplied at least two.

$ swfextract file.swf -i 1,2
warning! You should use the -P when extracting multiple objects

$ ls
file.swf  output.swf

$ swfextract file.swf -i 1,2 -P

$ ls
file.swf  output.swf
int_ua
  • 8,892

2 Answers2

3

Use this one-liner

swfextract --outputformat "extract_%06d.%s" -a 1- file.swf

If you want to extract to a dir content, make that dir first:

mkdir content
swfextract --outputformat "content/extract_%06d.%s" -a 1- file.swf

Works fine.

See the docs.

Janghou
  • 6,035
1

Here is a bash script to automate it:

#!/bin/bash
find_ext=".swf"
out_ext=".jpg"

[ "$1" == "" ] && echo "Add type arguments from swfextract: -j -p -f -F -m -i" && exit 1 

for arg in $@; do
    for file in `find . -name "*$find_ext"`; do 
    ids="`swfextract $file | grep "\[$arg\]" | sed 's#^.*ID(s) ##g' |  sed 's#, # #g'`"
        for id in $ids; do
            swfextract "$file" $arg $id -o "${file}_${id}${out_ext}"
        done
    done
done

Don't forget to check the *_ext variables. Feel free to improve the script by adding extensions automatically.

int_ua
  • 8,892