check logfile size and archivate
3
This subroutine will rename the log file once it gets to be
larger than 10k. It renames it to ArchiveLog_(Date).txt, so
it is easy to track down a certain day.
larger than 10k. It renames it to ArchiveLog_(Date).txt, so
it is easy to track down a certain day.
Sub CheckLogSize()
Dim oFSO, oFile, sLogFile, sOldLogFile
sLogFile = "d:\log.txt"
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oFile = oFSO.GetFile(sLogFile)
If oFile.Size > 10000 Then
Dim sTemp, oRE, sDate
sTemp = Date
Set oRE = New RegExp
oRE.Global = True
oRE.Pattern = "/"
sDate = oRE.Replace(sTemp, "_")
oFile.Name = "ArchiveLog_" & sDate & ".txt"
Set oRE = Nothing
End If
Set oFile = Nothing
Set oFSO = Nothing
End Sub






There are currently no comments for this snippet.