Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > skip path prune

Thread Tools

skip path prune
Posts: n/a
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.

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,

find ( {
wanted => \&wanted}, 'C:/Documents and

printf "\nThere are %d files in %d directories.\n",

sub wanted {

if (-d) {

print $File::Find::name, "\n" unless -d =~ /^folder3/;


elsif (-f _) {
print " <TR> <TD ALIGN=RIGHT>File name is




Reply With Quote
Mumia W.
Posts: n/a
On 07/17/2006 11:34 AM, Removed) wrote:
> How do you use the prune function to skip a printing all of the
> contents of a folder? [...]

Prune is not a function but a variable. Inside your wanted
function, if you see a directory that you don't want to look
inside, set $File::Find:rune to '1' to skip its contents.

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Update: how to prune newsrc thanatoid Computer Support 10 01-25-2009 03:08 AM
Find.prune if ( filename[-5,5] != ".java") is odd? Martin Elzen Ruby 2 04-25-2008 03:15 PM
skip path prune Perl Misc 0 07-17-2006 04:34 PM
Function to prune dictionary keys not working Girish Sahani Python 3 06-29-2006 12:33 AM
newbie : prune os.walk Rory Campbell-Lange Python 4 03-12-2005 06:44 AM