title: Delete files recursively with PowerShell
body: <p>I need to delete all files (recursively in all folders and subfolders) based on their <strong>last access</strong> time.</p>
  
  <p>I was looking at Stack Overflow post <em><a href="https://stackoverflow.com/questions/51054/batch-file-to-delete-files-older-than-n-days/51069#51069">Batch file to delete files older than N days</a></em> that suggested this answer:</p>
  
  <pre><code>forfiles -p "C:\what\ever" -s -m *.* -d &lt;number of days&gt; -c "cmd /c del @path"
  </code></pre>
  
  <p>However, this deletes files based on last modified time, not last access time.</p>
  
  <p>Also, is there a way to save the command in a script file so I can just doubleclick it to run?</p>