Hi Sunanda,

this is the function i used last. It is a modification of a script i
found.

dir-tree: func [
    current-path [file! url!] "directory to explore"
    /inner
    tree [block!] "useful to avoid stack overflow"
    /depth "recursion depth, 1 for current level, -1 for infinite"
    depth-arg [integer!]
    /local
    current-list
    sub-tree
    item
    server
    
][
    if all [not inner not block? tree] [tree: copy []]
    depth-arg: either all [depth integer? depth-arg] [depth-arg - 1][-1]
    current-list: read current-path
    if all [not none? current-list] [
    
        foreach item current-list [
        if not find/any to-string item "*log*" [
        if any [find/any to-string item ".cmd" find/any to-string item
        "/"] [
            if find/any to-string item ".cmd" [write/append
            %/c/allcmds.txt join current-path/:item newline]
              if all [dir? current-path/:item not-equal? depth-arg 0] [
                sub-tree: copy []
                dir-tree/inner/depth current-path/:item sub-tree
                depth-arg
                                 ]
                        ]
                ]
        ]
    ]
]

Perhaps you have some advice for me.

Thanks

Thorsten



On Fri, 3 Mar 2006 10:02:14 EST, [EMAIL PROTECTED] said:
> 
> Thorsten:
> 
> > Is there way to achieve this with less memory consumption???
> 
> Undoubtable!
> 
> But it would help having a sample bad script and some knowledge of what
> is 
> going wrong.
> 
> Diagnosing blindly, I suspect most such scripts are written to run 
> recursively, so a very deep folder structure could cause them to need a
> lot of stack 
> space.
> 
> A non-recursive solution will need far less interim storage.
> 
> But 500meg sounds a lot.
> 
> I dusted off the equivalent script I once wrote and tried it on my folder 
> structure, and it needed less than 100K of interim storage. But then may
> not have 
> so deep a tree as you.
> 
> Can you post an example of the code you are using?
> 
> Sunanda
> -- 
> To unsubscribe from the list, just send an email to 
> lists at rebol.com with unsubscribe as the subject.
> 

-- 
http://www.fastmail.fm - IMAP accessible web-mail

-- 
To unsubscribe from the list, just send an email to 
lists at rebol.com with unsubscribe as the subject.

Reply via email to