Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: How do I recurse all *but* a few directories?

by runrig (Abbot)
on Sep 16, 2000 at 22:21 UTC ( [id://32827]=note: print w/replies, xml ) Need Help??


in reply to How do I recurse all *but* a few directories?

I think it depends on whether your 'few' directories are full pathnames or all '.CVS' directories as above. Or some other requirement we don't know about.

Here's something that includes the first two:

use File::Find; my @abs_dirs=qw(/dont/go/here /stay/out); my @all_dirs=qw(.CVS .stayout); my %abs_dirs; @abs_dirs{@abs_dirs}=(); my %all_dirs; @all_dirs{@all_dirs}=() find (sub { $File::Find::prune=1, return if -d and (exists $abs_dirs{$File::Find: +:name} or exists $all_dirs{$_}); # Process other files, dirs # }, ".");

Update: runrigs fix (see below) was incorporated

Replies are listed 'Best First'.
RE: Answer: How do I recurse all *but* a few directories?
by runrig (Abbot) on Sep 17, 2000 at 20:01 UTC
    '$File::Find::dir' above should be '$File::Find::name', since '...dir' gives you the directory above the current directory '$_'.

    Too bad we don't get to edit Answers :(

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (2)
As of 2024-04-25 07:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found