Deep Space (was: The Directory Walker revisited)
David Vaughan
dvk at dvkconsult.com.au
Mon Sep 8 22:42:00 EDT 2003
On Monday, Sep 8, 2003, at 23:18 Australia/Brisbane, David Vaughan
<dvk at dvkconsult.com.au> wrote:
>
> Hmm. I have now encountered the same problem. As I wrote before, I had
> no difficulty with 100,000 files and directories 17 deep, but the same
> folders examined from their parent (the volume name) lead to a far
> higher depth count (should have been only 18)
snip
>
> The alternative might be some trigger into circularity, which is what
> happened with permissions.
Found it folks!
On OS X systems the folder //Network contains a reference to the local
computer, which is where you started, so round you go again.
I made a specific adjustment at the beginning of the handler, thus:
function walkDir dirPath
if dirPath contains "//Network" then
return empty
end if
-- etc as before
Running this worked across the entire root volume, returning over
230,000 files in a 24MB list (maxDepth 18 as expected), no problems.
The same circularity will equally affect an iterative routine, not only
a recursive approach, so whatever you do you need to protect against
the specific problem or simply not allow a user to walk from root. The
point of this exercise was to confirm that stack size did not limit a
recursive approach.
Note also WA's apparent problem with an X11 sub-folder, although
aliases did not appear to have added any circularity in my testing. Any
routine should also be tested specifically on a Linux or Windows
platform if it will be deployed there. The testing code comprises
displaying the current path every time you hit a new maxDepth.
regards
David
More information about the use-livecode
mailing list