Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

share|improve this question

3 Answers 3

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
share|improve this answer

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

share|improve this answer
1  
Note: You don't need to touch swfconvert. Gedit will automatically create the file after saving. –  Glutanimate Mar 15 at 9:54

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
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.