recursion limit when creating file list of harddrive

JB sundown at pacifier.com
Sun Oct 25 19:58:45 EDT 2015


I have been testing it out and it is working good
so far.  I set the cursor to watch after selecting.
I am not sure if setting it to busy in a repeat will
take too much time on large operations.

Is there and easy way to have it only list the
folder paths?

JB


> On Oct 25, 2015, at 3:39 PM, Alex Tweedly <alex at tweedly.net> wrote:
> 
> Well, it's a sad comment on my filing system, but it was easier to rewrite this handler from scratch (and memory) than it was to find the original :-)
> 
> Note this is done as a handler rather than a function, because it has 3 return values - a list of files, a list of folders, and a list of any errors. It would be trivial to convert to a function if you prefer that; I just dislike functions with return parameter values.
> 
> So, it's had a decent half-hour of testing, but no more than that. Usual money back guarantee applies ....
> 
> btw - there is a variant using "repeat for each line" which is marginally more efficient, but it depends on a quirk of the current LC implementation, which allows appending to the variable being iterated over - so I won't mention it here; it could (conceivably, but not likely) fail in some future version.
> 
> 
> on mouseUp
>   local theFolder
>   answer folder "Start where"
>   put it into theFile
> 
>   local filesList, folderList, errorList
>   put the millisecs into tStart
>   AllFiles theFile, true, filesList, folderList, errorList
> 
>   put filesList into field "Field 1"
> 
> end mouseUp
> 
> command AllFiles theFolder, pDetail, @pFiles, @pFolders, @pErrors
> 
>   set the defaultFolder to theFolder
>   if the result is not empty
>   then
>      put  "initial folder" & theFolder &CR afte rpErrorList
>      exit to top
>   end if
> 
>   put 0 into tHighest
>   put 0 into tCurrent
> 
>   add 1 to tHighest
>   put theFolder into tA[tHighest]
> 
>   repeat until tCurrent >= tHighest
> 
>      add 1 to tCurrent
> 
>      put tA[tCurrent] into tNow
>      set the defaultFolder to tNow
>      if the result is not empty then
>         put "Problem with" && tNow &Cr after pErrors
>         next repeat
>      end if
> 
>      if pDetailed then
>         put the detailed files into tF
>      else
>         put the files into tF
>      end if
> 
>      repeat for each line L in tF
>         put tNow & "/" & L &CR after pFiles
>      end repeat
> 
>      put the folders into tF
>      filter tF without ".*"
> 
>      repeat for each line L in tF
>         add 1 to tHighest
>         put tNow & "/" & L into tA[tHighest]
>      end repeat
> 
>   end repeat
> 
>   combine tA with CR
>   put tA into pFolders
> 
> end AllFiles
> 
> Let me know of any problems.
> -- Alex.
> 
> On 25/10/2015 03:12, JB wrote:
>>> On Oct 24, 2015, at 5:33 PM, Alex Tweedly <alex at tweedly.net> wrote:
>>> 
>>> 
>>> If that's not it, then you need to change to a serialized rather than a recursive treewalk - I'm sure that's been posted on the use-list some time ago (if you can't find it, let me know and I'll dig one up)
>>> 
>>> -- Alex.
>> I would like a copy of that if you
>> dig one up.
>> 
>> JB
>> 
>> 
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
> 





More information about the use-livecode mailing list