Private Sub Command1_Click()
    Dir1.Path = "f:\"
    GetAllFolders LstBox, Dir1
End SubPrivate Sub GetAllFolders(Lst As ListBox, ByVal Dir As DirListBox)
    Dim i As Long, Count As Long, sTemp As String
     
    With Dir
        Count = .ListCount
        If Count <> 0 Then
            For i = 0 To Count - 1
                Lst.AddItem .List(i)
                sTemp = .Path
                Dir.Path = .List(i)
                GetAllFolders Lst, Dir
                Dir.Path = sTemp
            Next
        End If
    End With
End Sub