skip path prune
- From: "weberw@xxxxxxxxxxxx" <weberw@xxxxxxxxxxxx>
- Date: 17 Jul 2006 09:34:53 -0700
How do you use the prune function to skip a printing all of the
contents of a folder? It will not print folder 3 but does print the
contents of folder 3 which I do not want printed.
#!C://Perl/bin/perl
use CGI ':standard';
use CGI::Carp 'fatalsToBrowser';
#use strict;
use warnings;
use File::Find;
my $file_count = 0;
my $dir_count = 0;
$title = "Find Files";
print header,
start_html($title),
h1($title);
find ( {
wanted => \&wanted}, 'C:/Documents and
Settings/whatever/Desktop/test');
printf "\nThere are %d files in %d directories.\n",
$file_count,
$dir_count;
sub wanted {
if (-d) {
print $File::Find::name, "\n" unless -d =~ /^folder3/;
$dir_count++;
}
elsif (-f _) {
print " <TR> <TD ALIGN=RIGHT>File name is
$File::Find::name</TD></TR><BR></BR>";
$file_count++;
}
}
end_hmtl;
.
- Follow-Ups:
- Re: skip path prune
- From: Mumia W.
- Re: skip path prune
- Prev by Date: skip path prune
- Next by Date: Re: why is perl -e 'unlink(glob("*"))' so much faster than rm ?
- Previous by thread: skip path prune
- Next by thread: Re: skip path prune
- Index(es):
Relevant Pages
|
|