Perhaps you don't realize that you can control the order in which File::Find descends, at least in 5.6:# This implements the logical recursion that we use to # cheat the order find() imposes;
So, for example, if you wanted all subdirectories to be processed after files, you could add:`preprocess' The value should be a code reference. This code reference is us +ed to preprocess a directory; it is called after readdir() but before + the loop that calls the wanted() function. It is called with a list + of strings and is expected to return a list of strings. The code c +an be used to sort the strings alphabetically, numerically, or to fil +ter out directory entries based on their name alone.
to the argument list (see the docs). I haven't played with this, because I'm still on 5.5.3 waiting for 5.6.1, but give it a whirl if you're already in the "new" zone.... preprocess => sub { sort { -d $a <=> -d $b } @_ }, ...
-- Randal L. Schwartz, Perl hacker
In reply to Re: It does exactly the opposite of what I want it to!
by merlyn
in thread It does exactly the opposite of what I want it to!
by SamQi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |