curtisb has asked for the wisdom of the Perl Monks concerning the following question:
Thanks Again!!!! curtisb = Upcoming Perl Programmer "Start Slow and Small!!!!"#!/usr/bin/perl -w use Cwd; print "Enter start directory: $workdir"; chomp($workdir = <STDIN>); 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(".");
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(jcwren) Re: First code test view
by jcwren (Prior) on Oct 11, 2000 at 01:08 UTC | |
by Fastolfe (Vicar) on Oct 11, 2000 at 01:59 UTC | |
|
Re: First code test view
by Trimbach (Curate) on Oct 11, 2000 at 01:24 UTC | |
|
Re: First code test view
by curtisb (Monk) on Oct 11, 2000 at 07:39 UTC |