Windows‎ > ‎

Delete Old Files

Delete files older than N days

delete_old.vbs

Dim fso, f, f1, fc
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder("J:\aaaa")
Set fc = f.Files
For Each f1 in fc
If DateDiff("d", f1.DateLastModified, Now) > 7 Then f1.Delete
Next

Comments