Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Gather file count in directory

by ~~David~~ (Hermit)
on Jan 05, 2012 at 14:22 UTC ( #946406=note: print w/ replies, xml ) Need Help??


in reply to Gather file count in directory

I always like the File::Slurp module.

use File::Slurp; my $dir = 'somedir'; my @files = read_dir( $dir ); my $num_of_files = scalar @files;


Comment on Re: Gather file count in directory
Download Code
Re^2: Gather file count in directory
by mr.nick (Chaplain) on Jan 05, 2012 at 18:14 UTC
    If you're willing to slurp in the entire filelist, you can also do
    my $num_of_files = scalar @{[<*>]};

    mr.nick ...

Re^2: Gather file count in directory
by Anonymous Monk on Jan 06, 2012 at 06:24 UTC

    The File::Slurp method is not giving the total number of files in a drive (as in C:// etc). It only gives an upper count of the files in directory doesnt give the count of files in folders ..

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (13)
As of 2014-07-30 21:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (240 votes), past polls