title: Exclude displaying certain folders and subfolders in a Treeview
body: <p>on one of my drives I have a folder structure ex</p>
  
  <p>d:\</p>
  
  <pre><code>123
      Code
          testfile.cs
      Database
          Backup.mdb
      Requirements
          Sprint1.xls
  
  234
     20132305
          20132205
              20132105 
     Database  
  </code></pre>
  
  <p>I would like to in my treeview show the following</p>
  
  <p>d:\</p>
  
  <pre><code>123
  
      Code
          testfile.cs
      Database
          Backup.mdb 
  
  234
     Database  
  </code></pre>
  
  <p>i.e only show folders and subfolders for "code" and "database"</p>
  
  <p>Here is the code to load the treeview</p>
  
  <p>folderLst  = {"123","234"}</p>
  
  <pre><code>   private void PopulateTreeView()
      {
          TreeNode rootNode;
          foreach (string f in folderLst)
          {
  
              DirectoryInfo info = new DirectoryInfo(@"d:\");
              if (info.Exists)
              {
                  rootNode = new TreeNode(info.Name);
                  rootNode.Tag = info;
                  GetDirectories(info.GetDirectories(), rootNode);
                  treeView1.Nodes.Add(rootNode);
              }
          }
      }
  
  
    private void GetDirectories(DirectoryInfo[] subDirs, TreeNode nodeToAddTo)
      {
          TreeNode aNode;
          DirectoryInfo[] subSubDirs;
          foreach (DirectoryInfo subDir in subDirs)
          {
              aNode = new TreeNode(subDir.Name, 0, 0);
              aNode.Tag = subDir;
  
              subSubDirs = subDir.GetDirectories();
              if (subSubDirs.Length != 0)
              {
                  GetDirectories(subSubDirs, aNode);
              }
  
              nodeToAddTo.Nodes.Add(aNode);
          }
      }
  </code></pre>
  
  <p>any help is appreciated</p>