Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^4: quickest way to find number of files in a directory?

by Anonymous Monk
on Mar 13, 2010 at 02:02 UTC ( [id://828383]=note: print w/replies, xml ) Need Help??


in reply to Re^3: quickest way to find number of files in a directory?
in thread quickest way to find number of files in a directory?

Hi; What I would like is a Perl native recursive descent file counter, not just the files in one directory, but nested directories as well. I would like the equivalent of: "find $dir | wc -l" # I want all (files, dirs and symlinks) I tried File::Find where my wanted was "sub {$file_count++}", but I get a warning "variable will not stay shared", but it seems to be the correct number. Is there a better way? Native Perl (or CPAN, but I don't see this on CPAN)... Thanks, Ken Wolcott
  • Comment on Re^4: quickest way to find number of files in a directory?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (8)
As of 2024-04-23 16:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found