http://www.perlmonks.org?node_id=951367


in reply to Re: Optimizing performance for script to traverse on filesystem
in thread Optimizing performance for script to traverse on filesystem

If I use

while ( my $name = readdir( DIR )) { ... }
I have to leave DIR opened while walking deeper in recursive
Only when all directories on the level are scaned, I can closedir(DIR)
Isn't it problematic ?

Replies are listed 'Best First'.
Re^3: Optimizing performance for script to traverse on filesystem
by GrandFather (Saint) on Feb 02, 2012 at 22:19 UTC

    Is the structure likely to be more than a few tens of directories deep? If not, no problem. If it is then you'll have to work really hard to fix the problem regardless of what tools you use because most simple solutions will keep directory handles open.

    True laziness is hard work