title: Directory and subdirectory Filter in Linq
body: <p>I need to list all directories from a path. I need to get only last subdirectory path and not all paths.</p>
  
  <p>i.e. for</p>
  
  <p>pathbase/2016/01</p>
  
  <p>I don't need pathbase/2016 but pathbase/2016/01</p>
  
  <p>Now I'm using this code:</p>
  
  <pre><code>List&lt;string&gt; dirs = new List&lt;string&gt;(Directory.EnumerateDirectories(pathBase));
  string[] entries = System.IO.Directory.GetDirectories(pathBase, "*", 
      SearchOption.AllDirectories);
  
  var listDir = from dir
                in entries
  
  return listDir.ToList();
  </code></pre>
  
  <p>What type of filter can i use in Linq to exclude this directory? </p>
  
  <p>Thanks.</p>