title: c# Build a directory tree
body: <p>I am trying to build a directory tree in my application. 
  I am using this <a href="http://examples1.ext.net/#/TreePanel/Loaders/PageTreeLoader/" rel="nofollow noreferrer" title="Example">Example</a> from <code>Ext.NET</code>.
  How I can search a given path for directories and sub-directories in order to build this tree?</p>
  
  <p>Here is the code given in the example to build the tree from nodes:</p>
  
  <pre><code>protected void NodeLoad(object sender, NodeLoadEventArgs e)
      {
  
          if (!string.IsNullOrEmpty(e.NodeID))
          {
              for (int i = 1; i &lt; 6; i++)
              {
                  AsyncTreeNode asyncNode = new AsyncTreeNode();
                  asyncNode.Text = e.NodeID + i;
                  asyncNode.NodeID = e.NodeID + i;
                  e.Nodes.Add(asyncNode);
              }
  
              for (int i = 6; i &lt; 11; i++)
              {
                  Ext.Net.TreeNode treeNode = new Ext.Net.TreeNode();
                  treeNode.Text = e.NodeID + i;
                  treeNode.NodeID = e.NodeID + i;
                  treeNode.Leaf = true;
                  e.Nodes.Add(treeNode);
              }
          }
      }
  </code></pre>