Script to Delete Files Over 2 Days Old?
Posted on 2012-09-18
We have a SQL server with a maintenance plan that is set to remove backup data older than two days.
For whatever reason, the maintenance plan is not removing any of the previous backups and the disk space is filling to capacity with backup data.
Our DBA is busy working on priority issues and will not be able to address this maintenance plan issue any time soon.
As a temporary measure, I would like to create a script that would check the contents of a directory, look at the dates, and then delete everything older than two days.
Scripting is not a strong point of mine – I could really use some guidance on creating a BAT or VBS script that will check the dates of files within a directory and then delete everything older than two days.
Any help would be greatly appreciated.