Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
' ################################################################
' # cleanup-folder.vbs
' #
' # Removes all files older than 1 week only if more
' # than 4 files present in directory
' ################################################################
Dim fso, f, f1, fc, strComments, strScanDir
' user variables
' ----------------------------------------------------------------
strDir = "c:\test"
strDays = 7
' DO NOT EDIT BELOW THIS LINE
' (unless you know what you are doing)
'------------------------------------------------------------------
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder(strDir)
[b]If f.SubFolders.Count > 5 Then
For Each sf In f.SubFolders
If DateDiff("d", sf.DateCreated, Date) > strDays Then
sf.Delete True
End If
Next
End If[/b]
Better?
Cheers,
MakeItSo
beefstew said:Any folder withind the root should be deleted (And all of its contents) but only if the folder was created 7 Days ago. It should only run if the are 5 or more folders within the root directory