Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

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;

Replies are listed 'Best First'.
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?

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2016-10-26 05:26 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (335 votes). Check out past polls.