[RESOLVED] List all folders from a given directory
Hello once again :wave:
I want to list all folders from a given directory. I've done this code but it only lists in one level and I want to list all levels.
Can you guys give help to make it work?
VB Code:
Public Sub ListDir(path As String)
Dim NameFolder As String
NameFolder = Dir(path, vbDirectory)
Do While NameFolder <> ""
If NameFolder <> "." And NameFolder <> ".." Then
If (GetAttr(path & NameFolder) And vbDirectory) = vbDirectory Then
MainForm.MSHFlexGrid1.AddItem (path & NameFolder & "\")
End If
End If
NameFolder = Dir
Loop
End Sub
Thank you
Re: List all folders from a given directory
You'll have to do it with recursion. Here's an example ;)
Re: List all folders from a given directory
It is exactly what I wanted.
Thank you very much.
Re: [RESOLVED] List all folders from a given directory