Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Beginners guide to File::Find

by Aristotle (Chancellor)
on Dec 04, 2002 at 00:10 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://217378]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (7)
As of 2024-03-28 19:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found