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

Beginners guide to File::Find

by spurperl (Priest)
on Dec 03, 2002 at 09:41 UTC ( #217166=perltutorial: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    use File::Find;
    
  2. or download this
    use File::Find;
    
    ...
    {
        #.....
    }
    
  3. or download this
    use File::Find;
    
    ...
    {
        print if -d;
    }
    
  4. or download this
    print if -d;
    
  5. or download this
    print $_ if -d $_;
    
  6. or download this
    sub print_name_if_dir
    {
    ...
    
        print $file if -d $file;
    }
    
  7. or download this
    use File::Find;
    
    my $dir = # whatever you want the starting directory to be
    
    find(sub {print if -d}, $dir);
    
  8. or download this
    use File::Find;
    
    find(sub {print $File::Find::name if -d}, ".");
    
  9. or download this
    use File::Find;
    
    find({wanted => sub {print $File::Find::name if -d}
          no_chdir => 1}, ".");
          
    
  10. or download this
    #!/usr/local/bin/perl -w
    
    ...
    {
        printf "%10d %s\n", $size{$_}, $_;
    }
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2016-10-01 20:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?






    Results (7 votes). Check out past polls.