Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Beginners guide to File::Find

by Aristotle (Chancellor)
on Dec 04, 2002 at 00:10 UTC ( #217378=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    #!/usr/bin/perl -w
    use strict;
    use Getopt::Std;
    ...
    }
       
    printf "%10d $_\n", $size{$_} for @sorted[0 .. $maxidx];
    
  2. or download this
    find( { wanted => \&print_if_dir, }, @dirs);
    
    # or
    
    find( { wanted => sub { print if -d }, }, @dirs);
    
  3. or download this
    find( {
        preprocess => sub { return grep { -d } @_ },
        wanted => sub { print },
    }, @dirs);
    
  4. or download this
    my ($min_depth, $max_depth) = (2,3);
    
    find( {
    ...
        return if $depth < $min_depth;
        print;
    }
    
  5. or download this
    #!/usr/bin/perl -w
    use strict;
    use Getopt::Std;
    ...
        wanted => sub { unlink if -f $_ and -M _ > $max_age_days },
        postprocess => sub { rmdir $File::Find::dir },
    }, @ARGV);
    

Log In?
Username:
Password:

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

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

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











    Results (143 votes), past polls