title: script to delete folders based on date
body: <p>I've done some looking but just can't find the exact code. What I have is a series of server backups that are backed up to a remote location. I need a way to have a windows script that runs each night for this remote location server and deletes files based on the number of days I need to keep.</p>
  
  <p>Each night a script based backup is done with a unique file name using the %random% tag. I need to keep, for example, the last 20 days worth of backups, and delete the rest</p>
  
  <p>I looked at the "forfiles" but that delete's all files after a certain number of days inside all sub folders.</p>
  
  <p>I just need a simple script that looks at the date of main folder (directory) in a given folder. It removes and deletes that folder and all subfolders based on the date.</p>
  
  <p>Thanks in advance</p>