Imports System
Imports System.IO
Public Class MainClass
Shared Sub Main()
Dim nameOfDirectory As String = "C:\"
Dim myDirectory As DirectoryInfo
myDirectory = New DirectoryInfo(nameOfDirectory)
WorkWithDirectory(myDirectory)
End Sub
Shared Public Sub WorkWithDirectory(ByVal aDir As DirectoryInfo)
Dim nextDir As DirectoryInfo
WorkWithFilesInDir(aDir)
For Each nextDir In aDir.GetDirectories
WorkWithDirectory(nextDir)
Next
End Sub
Shared Public Sub WorkWithFilesInDir(ByVal aDir As DirectoryInfo)
Dim aFile As FileInfo
For Each aFile In aDir.GetFiles()
Console.WriteLine(aFile.FullName)
Next
End Sub
End Class
|