Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

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

by Anonymous Monk
on Mar 27, 2007 at 20:22 UTC ( #606866=note: print w/replies, xml ) Need Help??


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

That depends on your shells. At least under bash, you can use glob() to grab dot files, for example:
  print "$_\n" for grep{ -f } glob(".*");
Or probably if you want to grab both dot and non-dot files:
  print "$_\n" for grep{ -f } glob("{*,}.*");
Regards,
Xicheng
  • Comment on Re^3: quickest way to find number of files in a directory?

Replies are listed 'Best First'.
Re^4: quickest way to find number of files in a directory?
by ferreira (Chaplain) on Mar 27, 2007 at 20:30 UTC

    Nope. It does not depend on your shell. At least not if you're using Perl 5.6 or later, because glob is implemented via the standard File::Glob extension and does not rely on shell anymore.

    The standard behavior of <*> or glob('*') is to not consider the dot files.

      In the example given, glob is not used with '*'.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (7)
As of 2020-11-23 16:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?