Skip to content

Instantly share code, notes, and snippets.

@oswaldoacauan
Created March 22, 2015 02:50
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save oswaldoacauan/35b5d426d04819926ce7 to your computer and use it in GitHub Desktop.
Save oswaldoacauan/35b5d426d04819926ce7 to your computer and use it in GitHub Desktop.
SWFExtract All Files
#!/bin/sh
for i in ./*.swf ; do
for j in `swfextract $i | grep -E PNGs.* -o | grep -E [0-9]+ -o` ; do
echo "$i -> extract png $j";
swfextract -p "$j" "$i" -o "$i"_"$j".png
done
for j in `swfextract $i | grep -E JPEGs.* -o | grep -E [0-9]+ -o` ; do
echo "$i -> extract jpeg $j";
swfextract -j "$j" "$i" -o "$i"_"$j".jpg
done
for j in `swfextract $i | grep -E Shapes.* -o | grep -E [0-9]+ -o` ; do
echo "$i -> extract shapes $j";
swfextract -i "$j" "$i" -o "$i"_"$j".swf && swfrender "$i"_"$j".swf -o "$i"_"$j".png
done
for j in `swfextract $i | grep -E MovieClips.* -o | grep -E [0-9]+ -o` ; do
echo "$i -> extract movieclips $j";
swfextract -i "$j" "$i" -o "$i"_"$j".swf
done
done
@scottfc
Copy link

scottfc commented Feb 25, 2018

Thank you, this is very helpful.

@jonhassall
Copy link

Be aware swfextract groups continuous ranges:
e.g.:
[-s] 44 Sounds: ID(s) 1-44

@i-rinat
Copy link

i-rinat commented Oct 31, 2021

Raw extraction part can be reduced to:

#!/bin/sh
for i in ./*.swf ; do
    swfextract --outputformat "extract_%06d.%s" -a 1- "$i"
done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment