C diskin içindeki tüm dosya ve klasörleri metin belgesine yazdırmak istiyorum ama aşağıdaki kod ile sadece ana dizinleri alabildim bunun için ne yapabiliriz.

Dim file As String = "D:\1231.txt"
Dim Yaz As StreamWriter = New StreamWriter(file)
Dim List As String() = Directory.GetDirectories(@"C:\")
For Each item1 In List
Yaz.WriteLine(item1)
Dim List2 As String() = Directory.GetFiles(item1)
For Each item In List2
Yaz.WriteLine(item)
Next
Next


Yaz.Close()