in reply to Filesystem: How to grab subset of directory structure

Perhaps stuffing the whole list into memory just to throw most of them away is making things slow (doesn't seem very likely with only 20,000 file names, but worth considering):

while( defined( $_ = readdir MYDIRHANDLE ) ) { push @aryFiles, $_ if /\.xml$/i; } closedir MYDIRHANDLE; # ^^^ note this
(:

I'd recommend the much simpler glob("*.xml"), but it appears that there are some alarming inefficiencies there that need investigation. |:

                - tye

Replies are listed 'Best First'.
Re: Re: Filesystem: How to grab subset of directory structure (less RAM?)
by P0w3rK!d (Pilgrim) on Jun 25, 2003 at 18:50 UTC
    I am taking a snapshot of the XML files in the directory at time (t). I process all the files I read in, sleep for a little while, then start the process again. Looping all the way... BTW-I already put everything into memory. The "read" of the files in the directory is what is pegging the CPU.

    Thanks for your reply. :)

    -P0w3rK!d