title: Batch script to delete file older than 1 day using creation date
body: <p><strong>Batch script to delete file older than 1 day.</strong></p>
  
  <p><strong>D</strong> means: <strong>Run date</strong> am passing through command prompt.</p>
  
  <p>How to subtract one day in D.</p>
  
  <p>I want to delete one day old file,the file name starting with <strong>olddayfile_20140323.txt</strong> in same code.</p>
  
  <p>Am using below code for Deleting D (D:current day file) files.</p>
  
  <pre><code>@echo on
  
  rem %1 %2 %3 - YYYY MM DD
  
  set folder1="C:\FX\in"
  
  set folder2="C:\FX\out"
  
  set D=%1%2%3%
  
  cd /d %folder2%
  
  del test1_%1%2%3*
  
  del test2_%1%2%3*
  
  del test3_%1%2%3*
  </code></pre>
  
  <p>Please note below script is working,but it's working only modified date files.</p>
  
  <pre><code>forfiles.exe /p C:\FX\out /s /m olddayfile_* /d -1 /c "cmd /c del @file"
  </code></pre>
  
  <p>Please suggest me am new for Batch script.</p>