标签:cal monk logs rom div erro 删除 log object
copy from http://www.cnblogs.com/MasterMonkInTemple/p/7655734.html
dim folder, file, mFSO, subfolder
Set mFSO = CreateObject(
"Scripting.FileSystemObject"
)
set folder=mFSO.GetFolder(
"C:\Users\msautotestuser\AppData\Local\Temp"
)
‘Delete files
dim df
For Each file In folder.files
‘df=DateDiff("h",file.DateCreated,Now) ‘
Create Date
df=DateDiff(
"h"
,file.DateLastModified,Now) ‘Modify Date
If (df>
2
) Then ‘
2
hours ago
‘MsgBox folder.path & "\" & file.Name & vbTab & file.DateCreated
‘MsgBox folder.path & "\" & file.Name & vbTab & file.DateLastModified
On Error Resume Next
file.Delete()
End If
Next
‘Delete folders
set subfolder = Folder.subFolders
For Each file In subfolder
‘df=DateDiff("h",file.DateCreated,Now) ‘
Create Date
df=DateDiff(
"h"
,file.DateLastModified,Now) ‘Modify Date
If (df>
2
) Then ‘
2
hours ago
On Error Resume Next
mFSO.deleteFolder(folder.path & "\" & file.Name)
end
if
next
标签:cal monk logs rom div erro 删除 log object
原文地址:http://www.cnblogs.com/kill0001000/p/7655898.html