VBScript - Archive Log by Separating Filename and ID

Environment
  • Microsoft Windows XP
Introduction
Running recursion to generate its id

Code
'Archive the log by separating filename and id
'For example: filename.log.1
'Running recursion
'Param String sLog
'Param int id
'Return String archiveLog
Function archiveLog(sLog, id)
    Dim oFSO, oFile
    Set oFSO = CreateObject("Scripting.FileSystemObject")
   
    If oFSO.FileExists(sLog & "." & id) Then
        archiveLog = archiveLog(sLog, id + 1)
    Else
        archiveLog = sLog & "." & id
    End If
End Function