Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

plakshmi : Is Perl effecient for Directory level search?

by Anonymous Monk
on May 08, 2012 at 14:08 UTC ( [id://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 (Canon) on May 08, 2012 at 14:12 UTC
    A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://969468]
Approved by moritz
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (8)
As of 2024-04-18 06:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found