RATE THIS ANSWER
+1
Click to Vote:
1
0
Hello, I think that this will solve your problem, just save the following code as whateveryoulike.vbs and schedule it (remember: the user that runs the scheduled job must have access to the "
WhatchFolder ").
Const WhatchFolder = "C:\TheFolder"
Const MaxDays = 30
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(WhatchFolder)
Set colFiles = objFolder.Files
For Each objFile in colFiles
If DateDiff("d",objFile.DateCreated,now) >= MaxDays Then
objFSO.DeleteFile(objFile.Path)
End If
Next
I hope this helps.