Imports System
Imports System.IO
Public Class Test
Public Shared Sub Main()
Dim di As DirectoryInfo = New DirectoryInfo("c:\")
Try
Dim dirs As DirectoryInfo() = di.GetDirectories("*p*")
Console.WriteLine(dirs.Length)
Dim diNext As DirectoryInfo
For Each diNext In dirs
Console.WriteLine("The number of files in {0} is {1}", diNext,diNext.GetFiles().Length)
Next
Catch e As Exception
Console.WriteLine("The process failed: {0}", e.ToString())
End Try
End Sub
End Class