DirectoryInfo.GetDirectories(String filter) : DirectoryInfo « System.IO « VB.Net by API






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

1.New DirectoryInfo
2.DirectoryInfo.CreationTime
3.DirectoryInfo.FullName
4.DirectoryInfo.GetDirectories()
5.DirectoryInfo.GetFiles
6.DirectoryInfo.LastAccessTime
7.DirectoryInfo.LastWriteTime
8.DirectoryInfo.Root