DirectoryInfo.GetDirectories(String filter)
Imports System.IO
Module Module1
Sub Main()
Dim Root As New DirectoryInfo("C:\")
Dim Files As FileInfo() = Root.GetFiles("*.*")
Dim Dirs As DirectoryInfo() = Root.GetDirectories("*.*")
Console.WriteLine("Root Directories")
Dim DirectoryName As DirectoryInfo
For Each DirectoryName In Dirs
Try
Console.Write(DirectoryName.FullName)
Console.Write(" contains {0} files ", DirectoryName.GetFiles().Length)
Console.WriteLine(" and {0} subdirectories ", DirectoryName.GetDirectories().Length)
Catch E As Exception
Console.WriteLine("Error accessing")
End Try
Next
End Sub
End Module
Related examples in the same category