
use strict;
use warnings;

open(INFILE,   "<  $ARGV[0]") || die("can't open inputfile: $ARGV[0]");

my $fname = "";
my $fext = "";
my $wait = "";
my $name = "";
my $retval = "";

while (<INFILE>) {
	chomp($_);
	print "$_\n";
	($fname,$fext) = split(/\./,$_);
	print "file name:      $fname\n";
	print "file extension: $fext\n";
	
	opendir(DIR, $fname) || print "no $fname directory!\n";
	$wait = <STDIN>;
	
	while ($name = readdir(DIR)) {
	   print "$name\n";
	   $name = $fname."\\".$name;
	   unlink($name);
	   print "$name\n";
	   
        }
	rmdir($fname) || warn "cannot delete $fname: $!";
	$wait = <STDIN>;
} #endwhile