原来这个应用程序每天都产生大量的Log文件也没有人清理过,从网上找了段脚步然后自己改了改做了一个Scheduled task job每天定时的清理旧的Log. Source Code如下:
'************ Start of Code **********************
Option Explicit
On Error Resume Next
Dim oFSO,oFolder,sDirectoryPath
Dim oFileCollection,oFile,sDir
Dim iDaysOld
On Error Resume Next
Dim oFSO,oFolder,sDirectoryPath
Dim oFileCollection,oFile,sDir
Dim iDaysOld
' Specify Directory Path From Where You want to clear the old files
sDirectoryPath = "C:\log"
' Specify Number of Days Old File to Delete
iDaysOld = 15
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oFolder = oFSO.GetFolder(sDirectoryPath)
Set oFileCollection = oFolder.Files
Set oFolder = oFSO.GetFolder(sDirectoryPath)
Set oFileCollection = oFolder.Files
For each oFile in oFileCollection
'This section will filter the log file
If LCase(left(Cstr(oFile.Name),8)) = "info.log" Then
If oFile.DateLastModified < (Date() - iDaysOld) Then
oFile.Delete(True)
End If
End If
Next
If LCase(left(Cstr(oFile.Name),8)) = "info.log" Then
If oFile.DateLastModified < (Date() - iDaysOld) Then
oFile.Delete(True)
End If
End If
Next
Set oFSO = Nothing
Set oFolder = Nothing
Set oFileCollection = Nothing
Set oFile = Nothing
Set oFolder = Nothing
Set oFileCollection = Nothing
Set oFile = Nothing
'**************** End of Code *******************