develooper Front page | perl.beginners | Postings from October 2009

About internal working of File::Find

Thread Next
Harry Putnam
October 28, 2009 12:55
About internal working of File::Find
Message ID:
Looking over the perldoc File::Find output (perl 5.8.4)

I see at finddepth it says:
  [...] in part

       "finddepth()" works just like "find()" except that is invokes the
       &wanted function for a directory after invoking it for the direc-
       tory's contents.  It does a postorder traversal instead of a pre-
       order traversal, working from the bottom of the directory tree up
       where "find()" works from the top of the tree down.

I'm not so much interested in finddepth() but the part at the end:
  "find()" works from the top of the tree down.

Does that mean it will return newer files first if the tree is one
directory only.

It sound like it could easily not be related to which files get
returned first..

That it what I want to know about.

I've written a script that searched news/mail messages, but only the
headers, for a regex given on the cmdline.

When I get hits, they seem to come in older first order.
For example, if I use a regex that finds and returns the Date lines it
seems to be the older messages that come up first.

So on a directory with 50,000+ messages it might go through quite a
few messages to find a regex in the newly written messages.

Anyone know if find() works from older to newer, or if there is anyway
to alter that.  Or is that what `finddepth' does?.. sounds like it
does what I see find() doing.

But the description is only in terms of trees.  I'm interested in how
the actual leaves (files) get processed.

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About