charlespliler
asked on
Script to delete files older than 15 min.
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.Fi leSystemOb ject")
Set f = fso.GetFolder("d:\gcti\log s\ksc_sip_ agent_1\ar chive")
Set fc = f.Files
For Each f1 in fc
result = CSng(Now) - CSng(f1.DateLastModified)
If result > .25 Then
f1.Delete
End If
Next
Set fso = Nothing
Set f = Nothing
Set fc = Nothing
Here is the current script.
Dim fso, f, f1, fc, result
Set fso = CreateObject("Scripting.Fi
Set f = fso.GetFolder("d:\gcti\log
Set fc = f.Files
For Each f1 in fc
result = CSng(Now) - CSng(f1.DateLastModified)
If result > .25 Then
f1.Delete
End If
Next
Set fso = Nothing
Set f = Nothing
Set fc = Nothing
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Ok, glad i bothered.
Steve
Steve
result = CSng(Now) - CSng(f1.DateLastModified) * 60*24
If result > 15 Then
f1.Delete
End If
that will make it in minutes rather than days
Steve