View Full Version : Getting all Sub-Folders of a directory
thatoneguy 08-29-2007, 11:29 PM I know about GetDirectories however it only goes one depth in (the folders immediately in that folder). Is there an easy way without writing an intelligent recursive folder finder to just get all sub directories?
|
|
Gravey
08-30-2007, 12:16 AM
sure is! You may recall there's an example function in the reference called 'getFilesRecursive'. Well the first part of the function gets directories recursively so if you just want that part, it would be like this:
fn getDirsRecursive root =
(
dir_array = GetDirectories (root + "/*")
for d in dir_array do
join dir_array (GetDirectories (d + "/*"))
dir_array
)
now I have found that this function does not collect the root directory into dir_array so you can simply change (root + "/*") to root and it will.
CGTalk Moderation
08-30-2007, 12:16 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.