in reply to Re: Count folder/files in directory
in thread Count folder/files in directory

The OP tries to avoid counting the "." and ".." directories. Slip a "return if /^\.\.?\z/" in at the top of that anonymous sub, and I think that's it.

Replies are listed 'Best First'.
Re^3: Count folder/files in directory
by Corion (Patriarch) on May 22, 2008 at 16:14 UTC

    For me, File::Find does call the callback with $File::Find::name neither equal to . nor ... I would consider such behaviour buggy, myself. Not that I consider File::Find to be free of bugs, but using it beats implementing the recursive routine and worrying about meta entries returned from readdir.

Re^3: Count folder/files in directory
by runrig (Abbot) on May 22, 2008 at 16:32 UTC
    File::Find::find will only process a "." directory if that is the directory you are starting at (it also processes "." if you start at ".."). If you don't want to count the directory(s) you start from, I think the easiest thing is just to subtract the number of starting directories from the directory count.