title: Get all folder / directories list in VB.net
body: <p>This is my first Stackoverflow question, I'm learning VB and having a few problems with getting a list of all folders/directories on the system. I'm using the code included here and it seems to work until it hits the recycle bin folder, and some other system folders</p>
  
  <pre><code>Sub main()
  
      Dim DirList As New ArrayList
      GetDirectories("c:\", DirList)
  
  
      For Each item In DirList
          'add item to listbox or text etc here
      Next
  
  End Sub
  
  Sub GetDirectories(ByVal StartPath As String, ByRef DirectoryList As ArrayList)
      Dim Dirs() As String = Directory.GetDirectories(StartPath)
      DirectoryList.AddRange(Dirs)
  
      For Each Dir As String In Dirs
          GetDirectories(Dir, DirectoryList)
      Next
  End Sub
  </code></pre>
  
  <p>Can anyone help me with this? I'd like to know what is causing this first, and a good fix, or alternative way to do this.</p>
  
  <p>Thanks in advance.</p>