Hi Monks..
I have the following specifications to search a given directory(recursively) totally random with following limitations:
- The user would give a max limit which only has to be searched from the directory(Limit on size ie if directory is 100GB then 25% is randomly searched ie 25GB atmost which means the total size of all random files selected should not exceed 25GB)
- Only a few file extensions have to be searched like .txt,.doc etc
I thought over it and saw old nodes which gave me these strategies:
1. Use File::Find to recurse and then use shuffle in List::Util to get random files and then scan those random files.But this will create a very large array which contains the address of random files selected and also time will be significantly more.
2. Use file::find to recurse and simultaneously use rand function to sect file and then scan it immediately and then move to next random file. I do not know how to work in this approach
3. A module File::Random exists but it does not work for Windows as written in its limitations.
Also I am not able to decide how to implement the max size check(as told above). please provide guidance? Example codes or other approaches
Thnx..
One machine can do the work of fifty ordinary men. No machine can do the work of one extraordinary man.
-Elbert Hubbard
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.