Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Traversing directories recursively

by grinder (Bishop)
on Nov 20, 2007 at 10:15 UTC ( #651892=note: print w/replies, xml ) Need Help??


in reply to Traversing directories recursively

Use the CPAN, Luke.

#! /usr/bin/perl use strict; use warnings; use File::Find::Rule; my $start = shift || '.'; for my $obj (File::Find::Rule->in($start)) { print "$obj\n"; }

The key word in the module name is "Rule". You can add rules to restrict what is returned: files only, smaller or larger than a given size, belonging to foo, modified no more than 3 weeks ago, is read-only and so forth.

Get your rules right, and your own code becomes very simple.

• another intruder with the mooring in the heart of the Perl

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (2)
As of 2019-07-24 02:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If you were the first to set foot on the Moon, what would be your epigram?






    Results (32 votes). Check out past polls.

    Notices?