Howto: automatically remove files older than 'x' days
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:
Dim Fso
Dim Directory
Dim Modified
Dim Files
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
Next
Save this as filename.vbs
To execute this file, run:
cscript.exe filename.vbs
--------------------------------
You can read all about the 800a0408 error at http://www.computerperformance.co.uk/Logon/code/code_800A0408.htm
The quotation mark is not the correct ASCI character
Source: http://thebackroomtech.wordpress.com/2007/06/12/howto-automatically-remove-files-older-than-x-days/
0 Comments:
Post a Comment
<< Home