skip path prune

skip path prune

am 17.07.2006 18:34:18 von weberw

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 " File name is
$File::Find::name

";


$file_count++;

}
}


end_hmtl;