Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: How do I ignore an entire directory using File::Find? (find/rule)

by Anonymous Monk
on Jun 18, 2014 at 01:19 UTC ( #1090230=note: print w/ replies, xml ) Need Help??


in reply to How do I ignore an entire directory using File::Find?

find/rule is much easier to manage, see Re^2: getting picky with File::Find::Rule less typing find/rule , write something like

use File::Find::Rule qw/ find rule /; my $gonerDirs = rule( directory => name => [ 'baby', 'dead' ], qw/ prune discard/, ); ## use File::Find::Rule::Permissions (); ## ??? not for win32 ## my $keeperFiles = rule( file => permissions => [ '???' ],... ); my $keeperFiles = rule( file => exec => \&worldWriteable ... ); my @files = find( not => $gonerDirs , any => $keeperFiles , in => \@startdirs, );

Same deal

my @files = rule()->or( ## !IMPORTANT NOTE discard before prune with rule()/find() rule( name => [ 'baby','dead' ], qw/ directory discard prune /), rule( file => exec => \&worldWriteable,... ) )->in( @startdirs );

Where you write

sub worldWritable { my( $shortname, $path, $fullname ) = @_; ## $shortname == $_; ... return 1 if $want; return 0 if not $want; }


Comment on Re: How do I ignore an entire directory using File::Find? (find/rule)
Select or Download Code
Re^2: How do I ignore an entire directory using File::Find? (find/rule)
by theillien1 (Acolyte) on Jun 18, 2014 at 03:48 UTC
    I'm not entirely sure I'm following your example.

      I'm not entirely sure I'm following your example.

      Ok then :) do you have a question?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1090230]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (19)
As of 2014-09-23 15:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (224 votes), past polls