Does anyone know if there is a way to make NTBackup delete backups
after say they get older than a month or whatever?
Ntbackup is a basic product and it has no advanced facility like the one
you're after. One way to achieve your aim is to name each backup file after
the day when it was made, e.g. 10.bkf, 29.bkf, 30.bkf. In this way old file
are automatically overwritten. Another way is to use a script like this one:
[01] '--------------------------------------------
[02] 'This script will delete .bkf files that were
[03] 'created "MaxAge" days ago.
[04] '30.1.2009 FNL
[05] '--------------------------------------------
[06] Active = false
[07] sSource = "d:\Sat"
[08] iMaxAge = 10 'days
[09]
[10] Checked = 0
[11] Deleted = 0
[12]
[13] Set oFSO = CreateObject("Scripting.FileSystemObject")
[14] if active then verb = "Deleting """ Else verb = "Old file: """
[15] CheckFolder oFSO.GetFolder(sSource)
[16]
[17] WScript.echo
[18] if Active then verb = " file(s) deleted" else verb = " file(s) would be
deleted"
[19] wscript.echo Checked & " file(s) checked, " & Deleted & verb
[20]
[21] Sub CheckFolder (oFldr)
[22] For Each oFile In oFldr.Files
[23] if ucase(right(oFile.name, 4)) = ".BKF" then
[24] Checked = Checked + 1
[25] If DateDiff("D", oFile.DateLastModified, Now()) >iMaxAge Then
[26] Deleted = Deleted + 1
[27] WScript.Echo verb & oFile.Path & """"
[28] If Active Then oFile.Delete
[29] End If
[30] end if
[31] Next
[32] End Sub
Instructions:
1. Save the script to a suitable location, e.g. to
c:\Windows\DeleteOldFiles.vbs. Make sure to retain the .vbs extension.
2. Unwrap any lines that might be wrapped around.
3. Adjust lines 07 and 08 to suit your requirements.
4. Remove the line numbers.
5. Type this command at the Command Prompt:
cscript //nologo c:\Windows\DeleteOldFiles.vbs
6. If you're satisfied with what you see, activate the script by setting
line 06 to "Active = true".
7. Test the script again.
8. Create a scheduled tas that will run once every day, e.g. at 3pm. It must
run this command:
cscript //nologo c:\Windows\DeleteOldFiles.vbs