'************ 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
'**************** End of Code *******************