Display directories on your drive recursively : Function Recursive « Language Basics « VB.Net






Display directories on your drive recursively

Display directories on your drive recursively
Imports System
Imports System.IO


Public Class MainClass

   Shared Sub Main()
      Dim dirInfo As New DirectoryInfo("C:\")
      ListDirectories(dirInfo)
   End Sub 

  Shared Sub ListDirectories(ByVal theDirectory As DirectoryInfo)
    Dim tempDir As DirectoryInfo
    Console.WriteLine(theDirectory.FullName())
    For Each tempDir In theDirectory.GetDirectories()
      ListDirectories(tempDir)
    Next
  End Sub

End Class


           
       








Related examples in the same category

1.Function RecursiveFunction Recursive
2.Calculating factorials using recursionCalculating factorials using recursion
3.Recursive Function DemoRecursive Function Demo