Sub Main() Dim dirList As List(Of String) = New List(Of String)() Dim rootDi As DirectoryInfo = New DirectoryInfo("C:\\Windows")
ScanDirectory(rootDi, dirList)
For Each dirName As String In dirList Console.WriteLine(dirName) Next
End Sub
Sub ScanDirectory(ByVal di As DirectoryInfo, ByVal dirList As List(Of String)) For Each subDi As DirectoryInfo In di.GetDirectories() dirList.Add(subDi.FullName) ScanDirectory(subDi, dirList) Next End Sub
Sub ScanDirectory(ByVal di As DirectoryInfo, ByVal dirList As List(Of String)) dirList.Add(subDi.FullName) For Each subDi As DirectoryInfo In di.GetDirectories() ScanDirectory(subDi, dirList) Next End Sub
Så kommer rod-folderen også med.
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.