I have a folder with a lot of swf files. They are named that way: fis1.swf; fis2.swf; fis3.swf; ... fis20.swf
. I want to convert all of them into png files. I know it can be done with swfrender from swftools, but it only renders one file per time.
3 Answers
I'd probably use find
to do this:
find -iname 'fis*.swf' -exec swfrender "{}" -o "{}.png" \;
But you could probably use other sorts of loops:
for f in fis{1..20}.swf; do
swfrender "$f" -o "$f.png"
done
First make a new file and call it for example swfconvert
gedit swfconvert
Paste the code below into it:
for img in *.swf;
do
swfrender "$img" -o "$img.png"
done
Save and close. Then run the new batch from terminal:
sh swfconvert
This script should work for all swf files in a given directory. It should be saved in the same directory where your .swf files reside
-
1Note: You don't need to
touch swfconvert
. Gedit will automatically create the file after saving. Mar 15, 2014 at 9:54
Similar to Oli answer, you can also use convert
tool from imagemagick
set.
for f in fis{1..20}; do
convert $f.swf $f.png
done
This can be put into single line as
for f in fis{1..20}; do convert $f.swf $f.png; done