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 ..