Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
FolderBrowserDialog1.ShowDialog()
GetDirectoryandFiles(FolderBrowserDialog1.SelectedPath)
End Sub
Private Sub GetDirectoryandFiles(ByVal strPath As String)
Try
Dim strDir() As String
Dim strFile() As String
strDir = System.IO.Directory.GetDirectories(strPath)
strFile = System.IO.Directory.GetFiles(FolderBrowserDialog1.SelectedPath)
For i As Integer = 0 To strFile.Length - 1
ListBox1.Items.Add(strFile(i))
Next
For i As Integer = 0 To strDir.Length - 1
ListBox1.Items.Add(strDir(i))
GetDirectoryandFiles(strDir(i))
Next
Catch ex As Exception
End Try
End Sub