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


in reply to Re^2: Random Files Recursively Form Directory
in thread Random Files Recursively Form Directory

I don't see how the size of the files in a directory would affect File::Find, data structure preparation and shuffling the list. I would say that number of files in a directory would have an effect. What is the number of files per directory?

I would think File::Random would also be slow if the number of files in a directory is huge. A quick check of the code in File::Random make me think that it re-reads the whole directory every time you call random_file() and therefore you could get the same file returned more than one time.

  • Comment on Re^3: Random Files Recursively Form Directory

Replies are listed 'Best First'.
Re^4: Random Files Recursively Form Directory
by gautamparimoo (Beadle) on Apr 03, 2013 at 05:22 UTC

    Each directory consists of atleast 5000 files plus sub directories having atleast 3000 files. But any how it looks like the only possible solution so ill give it a try. Thnks...

    One machine can do the work of fifty ordinary men. No machine can do the work of one extraordinary man. -Elbert Hubbard