#!/usr/bin/perl

$eps_dir = "./$ARGV[0]";
$gif_dir = "./$ARGV[0]/gif_files";

system "rm -rf $gif_dir";
mkdir("$gif_dir",0755) or die "could not make directory: $!";

$number = 0;

opendir(DIR,"$eps_dir") or die "could not open $dir: $!";
while ($_=readdir(DIR)){
    if ($_ =~ /.eps$/ ){
	print "\t$number\t$_\n";
	system "convert $eps_dir/$_ $gif_dir/$number.gif";
	$number ++;
    }
}

closedir DIR;

exit;
