recursion limit when creating file list of harddrive

Richard Gaskin ambassador at fourthworld.com
Sat Oct 24 20:32:05 EDT 2015


Matthias Rebbe wrote:
> long time ago i created a program which creates a list of files of  backup cds or dvds and stores that listings in a database with some additional information like cd name/number.
> So if the customer needs to know on which cd/dvd a needed fileis,  the database can be searched. This worked fine a long time. But with time the customer used harddrives for the backups.
> So they imported now the file listing of harddrives. Even that worked fin. But now with bigger drives and more stuff stored on the drives my program is not able to import the file listing anymore if the number of files/folders exceed a special number. It just freezes.
>
> If i try to create a directory listing of such a drive in Livecode i get an recursion limit error telling me that the recursion limit of 400000 was reached. I tried to increase that limit, but i still get that error, but with the newly set value.
>
> I am using a script snippet which was posted by Scott Rossi to the list and was originally from Geoff Canyon in 2002.
> http://lists.runrev.com/pipermail/metacard/2002-August/002274.html
>
> Is there a way to scan a complete drive with LC regardless how many folders and subfolder that drive contains without getting that recursion limit error?

We had a couple discussions about this here a while back.  The problem 
isn't recursion per se, since of course it's highly unlikely that any 
hard drive will have folders nested more than 400,000 deep.

The recursion error is thrown when there's inadequate error checking on 
the "set the directory to..." line, so that the directory never changes 
and thus the routine sits in a loop working on the same directory over 
and over.

If you check "the result" immediately after the "set the directory..." 
line and skip when the result is not empty I think you'll find the rest 
of you code will work well on just about any drive you'll encounter.

-- 
  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web
  ____________________________________________________________________
  Ambassador at FourthWorld.com                http://www.FourthWorld.com




More information about the use-livecode mailing list