At 4:01 -0700 14/01/01, Salman Ahmed wrote:
> Can anyone tell me how to run a "repeat loop" which will list all the
>subdirectories when supplied the drive name. for e.g. if i supply the drive
>name as "c:\", the program should return all the subdirectories beneath it in
>the form of a tree.
Well, a tree is not exactly one of directors native types, but here's my stab:
It uses FileXtra3.
It returns a nested property list which constitutes a "tree".
Hope this can be of inspiration.
----<parent script: getFolderTreeClass>----
property pSep, pFxo
on mGetFolderTree me, aPath
pSep = the last char of the moviePath
if the last char of aPath <> pSep then aPath = aPath & pSep
pFxo = Xtra("FileXtra3").new()
tree = me.mGetSub(aPath)
pFxo = VOID
return tree
end
on mGetSub me, aPath
things = pFxo.fx_FolderToList(aPath)
tree = [:]
repeat with thing in things
if the last char of thing = pSep then \
tree.addProp(thing, me.mGetSub(aPath & thing))
end repeat
return tree
end
----</parent script: getFolderTreeClass>----
----<movie script: test>----
on t1
tPath = the applicationPath & "Xtras"
tree = script("getFolderTreeClass").mGetFolderTree(tPath)
put tree
end
----</movie script: test>----
Jakob
[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi To post messages to the list,
email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo. Thanks!]