'凡文件或是子文件夹在此停留10天以上即删除之。
Dim fso, f, f1, f2, fc, fd
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder("E:\SomeFolder\")
Set fc = f.Files
Set fd = f.SubFolders
For Each f2 in fd
If DateDiff("d", Now, f2.DateCreated) < -10 OR DateDiff("d", Now, f1.DateLastModified) < -10 Then
' WSCript.Echo f2.Name
fso.DeleteFolder f2, true
End If
Next
For Each f1 in fc
If DateDiff("d", Now, f1.DateCreated) < -10 OR DateDiff("d", Now, f1.DateLastModified) < -10 Then
' WSCript.Echo f1.Name
fso.DeleteFile f1, true
End If
Next
Bookmark this post:
|
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
![]() ![]() |
0 评论:
发表评论