2

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.

Braiam
  • 67,791
  • 32
  • 179
  • 269
gabrielsimoes
  • 47
  • 2
  • 6

3 Answers3

7

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
Oli
  • 293,335
1

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

kirchberger
  • 834
  • 1
  • 7
  • 17
1

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
Registered User
  • 9,631
  • 14
  • 53
  • 85