#!/bin/bash

cd svg

eps=`find ./ -type f -name '*.eps'`

for x in $eps
do
    tar cf - $x | tar -C ../eps -xf -           | exit 1
    tar cf - $x | tar -C ../../latex -xf -      | exit 1

    jpg=${x%%eps}jpg

    convert $x -background white -alpha remove $jpg     | exit 1
    tar cf - $jpg | tar -C ../jpg -xf -                 | exit 1
    tar cf - $jpg | tar -C ../../html -xf -             | exit 1

    rm $x $jpg                                          | exit 1
done
