title: Lambda expression returns excluded values in array
body: <p>I have some folders that I am reading through and processing some files</p>
  <pre><code>    const string claims = @&quot;\\myServerPath\Incident Reports\&quot;;
      const string archive = @&quot;\\myServerPath\Incident Reports\Archive\&quot;;
      const string errorData = @&quot;\\myServerPath\Incident Reports\DataErrorFiles\&quot;;
  </code></pre>
  <p>I am able to read through and extract all the data I need within these files.</p>
  <p>I then have the two file dirs, archive and errorData in an array like this</p>
  <pre><code>string[] excludeDirectories = new string[] { archive, errorData };
  </code></pre>
  <p>and I then try to loop through and do some cleanup like this</p>
  <pre><code>List&lt;string&gt; dirs = Directory.GetDirectories(claims, &quot;*&quot;, SearchOption.AllDirectories).Where(d =&gt; excludeDirectories.All(e =&gt;!d.StartsWith(e))).ToList();
  
  foreach(string s in SortByLength(dirs))
  {
      if (Directory.GetFiles(s).Count() == 0)
      {
           Directory.Delete(s);
      }
  }
  </code></pre>
  <p>Every time it deletes both directories.. What do I have wrong in my lambda expression that makes it keep including those two?</p>
  <p>Even weirder, is at the top where I am getting the files to process, I pick up the files in a similar fashion, and this works. Files in Archive or DataErrorFiles are ignored.</p>
  <pre><code>List&lt;string&gt; processFiles = Directory.GetFiles(claims, &quot;*.xlsx&quot;,
                      SearchOption.AllDirectories).Where(d =&gt; excludeDirectories.All(e =&gt;!d.StartsWith(e))).ToList();
  </code></pre>
  <p>When I have a file sitting on the 'root' dir of claims, it will pick these files up and process them. It then moves them to either archive or error accordingly. When I run through again (file now resides in archive), I do not read the file again. The exclude is working on getting the excel files, but not on the directory cleanup.</p>