DirectoryInfo.GetDirectories (String, SearchOption)
Imports System
Imports System.IO
Class App
Public Shared Sub Main()
Dim path As String = "c:\\"
Dim searchPattern As String = "c*"
Dim di As DirectoryInfo = New DirectoryInfo(path)
Dim directories() As DirectoryInfo = di.GetDirectories(searchPattern, SearchOption.TopDirectoryOnly)
Dim files() As FileInfo = di.GetFiles(searchPattern, SearchOption.TopDirectoryOnly)
Console.WriteLine(path)
Dim dir As DirectoryInfo
For Each dir In directories
Console.WriteLine(dir.FullName)
Next dir
Dim file As FileInfo
For Each file In files
Console.WriteLine(file.Name)
Next file
End Sub
End Class
Related examples in the same category