title: Trying to delete files older than x days vb.net
body: <p>I have a basic bit of code which I am using to delete text files within a given directory:</p>
  
  <pre><code>For Each file As IO.FileInfo In New IO.DirectoryInfo(filePath).GetFiles("*.txt")
      If (Now - file.CreationTime).Days &gt; intdays Then file.Delete()
      Next
  </code></pre>
  
  <p><code>filePath</code> is the directory where the files reside.</p>
  
  <p><code>intdays</code> is a variable which determines how many days the files should be retained for.</p>
  
  <p>To test the code i set intdays to 0, assuming that it would delete any files in the directoy. However it doesn't, but creates no errors.</p>
  
  <p>The time "Now" is #2/8/2012 13:59:00 PM# which is greater than 0. But I'm confused as to why it doesn't then delete the file?</p>