in reply to Re: how to get total numbers of files in a directory?
in thread how to get total numbers of files in a directory?
glob - Update: fixed bug as noted by sauoq below (it was originally going to be @{ [ glob "*.txt" ] }, that'll teach me for posting in a hurry :)use File::Find::Rule; my $cnt = find( file => name => "*.txt", maxdepth => 1, in => "/home/a" );
opendir, readdir + grepmy $cnt = () = glob "/home/a/*.txt";
opendir( my $d, "/home/a" ) or die "ack: $!"; my $cnt = grep { -f and /\.txt$/ } readdir $d;
_________
broquaint
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: how to get total numbers of files in a directory?
by sauoq (Abbot) on Dec 09, 2003 at 21:07 UTC |