I have the following code to try and get all file names in my parent directory and all its sub directories.
The code works, but not how I would like. Namely it will process all files in the parent directory and all in the "first- level" of sub directories but I want to be able to go into all levels of sub directories.
How do I do that?
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
'ListBox1.Items.AddRange(IO.Directory.GetFiles("C:\"))
For Each Dir As String In IO.Directory.GetDirectories("C:\Program Files")
' ListBox1.Items.Add(Dir)
ListBox1.Items.AddRange(IO.Directory.GetFiles(Dir))
Next
End Sub