recursion limit when creating file list of harddrive

Michael Doub mikedoub at gmail.com
Tue Oct 27 15:43:35 EDT 2015


Geoff,

I would suggest replacing the first statement of the function with

if c is empty then put -1 into c    -- set the default to go all the way 
down
put whatFolder & "/" & cr into R  -- add a "/" to directory output so 
they are more easily parsed later

-= Mike


On 10/27/15 12:18 PM, Geoff Canyon wrote:
> Revised. Now in function form, with error checking and depth control. You
> can hand in a positive number to get that number of layers deep, or a
> negative number to go all the way down. I tested it on my home directory
> and it came back fine (after some time). I haven't (knowingly) tested with
> unusual characters.
>
> on mouseUp
>     put directoryListing(fld "directory",round(the thumbposition of
> scrollbar "depth")) into field "listing"
> end mouseUp
>
> function directoryListing whatFolder,c
>     put whatFolder & cr into R
>     set the directory to whatFolder
>     if c = 0 or the result is not empty then return R
>     put the files into tFileList
>     sort tFileList
>     replace cr with cr & whatFolder & "/" in tFileList
>     put whatFolder & "/" & tFileList & cr after R
>     put line 2 to -1 of the folders into tDirList
>     sort tDirList
>     repeat for each line L in tDirList
>        put directoryListing((whatFolder & "/" & L),(c-1)) after R
>     end repeat
>     return R
> end directoryListing
>
>
> On Mon, Oct 26, 2015 at 12:00 AM, Geoff Canyon <gcanyon at gmail.com> wrote:
>
>> On Sat, Oct 24, 2015 at 7:28 PM, Matthias Rebbe | M-R-D <
>> matthias_livecode_150811 at m-r-d.de> wrote:
>>
>>> 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
>>>
>> Man, do I hate looking at my old code...
>>
> _______________________________________________
> 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