Tape backups have failed me too many times, so I now do my Windows backup to an external hard drive. One of the office staff is in charge of swapping out our backup drives and taking it offsite. I needed a solution that would remove old backups without user intervention so they wouldn’t have to worry about having enough space available for the backup to complete.
My hard drives can hold four backups, so here’s a very simple .vbs script that deletes files from I:\Backup Files that are more than three days old:
Set Fso = CreateObject(“Scripting.FileSystemObject”)
Set Directory = Fso.GetFolder(“I:\Backup Files”)
Set Files = Directory.Files
For Each Modified in Files
If DateDiff(“D”, Modified.DateLastModified, Now) > 3 Then Modified.Delete
Save this as filename.vbs
To execute this file, run:
Thanks to Don for the original script I modified for my particular needs.
I just added another script that automatically removes files older than ‘x’ days which uses the forfiles command that is native to Windows.
Here’s another simple script from KWSupport.