Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: quickest way to find number of files in a directory?

by kyle (Abbot)
on Mar 27, 2007 at 15:10 UTC ( #606769=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my $directory_name = shift || '.';
    
    ...
        or die "Can't opendir '$directory_name': $!";
    my $file_count = scalar grep { -f "$directory_name/$_" } readdir $dh;
    closedir $dh or die "Can't closedir: $!";
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (9)
As of 2020-12-03 20:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How often do you use taint mode?





    Results (57 votes). Check out past polls.

    Notices?