Script to delete files older than 15 min.
Posted on 2011-03-09
I have another script question. I have a script to delete files on individual Servers that runs after a copy process. Currently it deletes files that are older than 6 or so hours old. Because the copy process runs every 6 hours I am getting duplicate files. I need the script to delete files more than 15 minutes old.
Here is the current script.
Dim fso, f, f1, fc, result
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder("d:\gcti\logs\ksc_sip_agent_1\archive")
Set fc = f.Files
For Each f1 in fc
result = CSng(Now) - CSng(f1.DateLastModified)
If result > .25 Then
Set fso = Nothing
Set f = Nothing
Set fc = Nothing