Notifications
Clear all
[Closed] Getting all Sub-Folders of a directory
Aug 30, 2007 12:29 am
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?
1 Reply
Aug 30, 2007 12:29 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.