Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
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 rifling through the Monastery: (10)
As of 2015-07-07 11:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (88 votes), past polls