#!/usr/bin/perl -w use Cwd; print "Enter start directory: $workdir"; chomp($workdir = ); sub scandir { my ($workdir) = shift; #c:\mydocu~1\Netscape my ($startdir) = &cwd; #c:\mydocu~1\perl chdir($workdir) or die "Unable to change to $workdir:$!\n"; opendir(DIR, ".") or die "Unable to open $workdir:$!\n"; my @files = readdir(DIR) or die "Unable to read $workdir:$!\n"; closedir(DIR); foreach my $file (@files) { next if ($file eq "."); next if ($file eq ".."); if (-d $file) { &scandir($file); next; } if ($file eq '/\.log$/i || /\.\d+\w+\-\d+\wm$/i') { unlink($file) || warn "Unable to delete $file: $!\n"; } else{ print "Found File: $file\n"; } chdir($startdir) or die "Unable to change to $startdir: $!\n"; } } &scandir(".");