Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Gather file count in directory

by ~~David~~ (Hermit)
on Jan 05, 2012 at 14:22 UTC ( [id://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?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (2)
As of 2024-04-26 03:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found