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.
Non-pseudo looks like this:beefstew said:psuedo if exist more than 5 files
Set f = fso.GetFolder(strDir)
Set fc = f.Files
[b]If f.Files.Count > 5 Then[/b]
For Each f1 in fc
If DateDiff("d", f1.DateCreated, Date) > strDays Then
'strComments = strComments & f1.name & " " & f1.DateCreated & vbCrLf
fso.DeleteFile(f1)
End If
Next
[b]End If[/b]
Set f = fso.GetFolder(strDir)
If f.Files.Count > 5 Then
f.Delete True
'alternatively: fso.deletefolder f.Path
Else
Set fc = f.Files
For Each f1 in fc
If DateDiff("d", f1.DateCreated, Date) > strDays Then
'strComments = strComments & f1.name & " " & f1.DateCreated & vbCrLf
fso.DeleteFile(f1)
End If
Next
End If
That is why it's always a good choice to be precise rather than vague when asking for help.beefstew said:delete all sub folders over 7 days old, but only if there are more than 5 sub folders in total
Set f = fso.GetFolder(strDir)
Set fc = f.Files
For Each f1 in fc
If DateDiff("d", f1.DateCreated, Date) > strDays[b][COLOR=#CC0000] And f.Files.Count > 5[/color][/b] Then
'strComments = strComments & f1.name & " " & f1.DateCreated & vbCrLf
[b][COLOR=#CC0000]fso.DeleteFolder(f.Path)
Exit For[/color][/b]
End If
Next
more than 5 sub folders in total
Now WHAT exactly are the criteria?only want it to run if there are more than 5 files in the directory
beefstew said:This is what I have but it doesn't seem to work: