Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: How do I recursively process every file in a given directory?

by marcos (Scribe)
on May 02, 2000 at 14:15 UTC ( [id://9920]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    opendir (DIR, $dir) or die "cannot opendir $dir";
    foreach my $file (readdir(DIR)) {
        &process_file ($file);
    }
    closedir (DIR);
    
  2. or download this
    my @only_files = grep {-f "$dir/$_"} readdir(DIR);
    foreach my $file (@only_files) {
        &process_file ($file);
    }
    
  3. or download this
    map {&process_file} grep {-f "$dir/$_"} readdir(DIR);
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (6)
As of 2024-04-23 17:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found