in reply to Total Files
Without putting all the filenames into memory:
opendir DIR, "somedirectory" or die "opendir: $!\n"; my $count; !/\A\.\.?\z/ && $count++ while defined($_ = readdir(DIR)); closedir DIR or warn "closedir: $!\n"; print "$count\n";
(You'd need to add a -f or similar test for it to only consider plain files, or non-directories, etc.)
|
|---|