title: selecting previous day files from huge list of files
body: <p>I'm selecting previous day files from huge list of files <br ></p>
  
  <pre><code>// selecting around 80-120 files from 20,000 - 25,000 
  
  FileInfo[] files = (new DirectoryInfo(dirPath)).GetFiles("*.xml");
   string[] selectedFiles = (from c in files
                                            where c.CreationTime &gt;= DateTime.Today.AddDays(-1) &amp;&amp; c.CreationTime &lt; DateTime.Today.AddHours(-2.0)
                                            select c.FullName).ToArray();
  </code></pre>
  
  <p>The above takes around 4-5 mins to run, Can you please tell me how to optimize it, without changing functionality! <br ></p>
  
  <pre><code>// file selection is between yesterday 0:00 to yesterday 22:00 &lt;br &gt;
  </code></pre>
  
  <p>as shown in code above. <br >
  Kindly advice.  </p>