Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

plakshmi : Is Perl effecient for Directory level search?

by Anonymous Monk
on May 08, 2012 at 14:08 UTC ( #969468=perlquestion: print w/replies, xml ) Need Help??
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi We need to implement directory level search that gives the folder hierarchy and document count in that directory as OUTPUT. Directory level search in this context means there will be a parent folder which has many levels of subfolders under it. and subfolder again has its own child folders and files can be placed in any level of folder hierarchy. Is perl efficient to perform this operation? Do we need to use recursive call or is there anyother optimized way that achieves this operation in a very less time? Please provide ur views on it at the earliest

  • Comment on plakshmi : Is Perl effecient for Directory level search?

Replies are listed 'Best First'.
Re: plakshmi : Is Perl effecient for Directory level search?
by moritz (Cardinal) on May 08, 2012 at 14:14 UTC

    Unless you do something silly, Perl will not be your bottleneck, but rather the operating system or file system. File::Find implements that kind of recursive traversal.

    And a more efficient approach is to index the directory structure once, and then search the index instead of the directories. Of course that only works if the directories do not change too often.

      Thanks for ur reply. I have a straightforward question. Among .Net & PERL which is better to use for this operation. Also folders are placed in Network share. Currently am using .Net to achieve this, but I come across performance overhead. it is taking around 2mins to execute the operation. in this case if PERL is used, wt time it would take?

        I doubt the language will make much difference, the underlying operating system calls will probably be the same. If the folders are on a network share then you expect poor performance.
        I agree with cdarke probably no difference as the underlying OS calls are the same. However, there may be a way to change that assumption if you are using Windows NTFS. Read a bit about Wiki-NTFS and then have a look at this freeware: Ultrasearch. Microsoft may also have some updated tools itself - I couldn't find any updates to their nfi.exe tool (its an old one). Now caveat: I have not personally used this stuff and have no idea of how reliable it is! But the claim is that this thing reads the MFT (Master File Table) directly which has the potential to be a lot faster, albeit complicated and perhaps "dangerous". "Buyer beware!".

        For most applications a couple of minutes is probably not that big of a deal (not worth risk and a lot of work in the quest for absolute maximum speed). I mean messing around with a big network server has the potential to cause some pretty serious damage if things go wrong! Sounds like too much pain to save a minute or so. But I leave that tradeoff to you.

Re: plakshmi : Is Perl effecient for Directory level search?
by stevieb (Abbot) on May 08, 2012 at 14:12 UTC

      Thanks for ur reply. i have a new ost again. please give ur opinion on it also

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://969468]
Approved by moritz
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (6)
As of 2018-01-16 22:41 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (192 votes). Check out past polls.