I have a script that cycles through log files. As it reads each log file, it runs the sub below to open the output file, write a single line, then close the file.
Sub logStatus(message, account, sourcelog)
strFile = strBackupDir & strBackupFile
Set objFile = objFSO.OpenTextFile(strFile, 8, true)
objFile.WriteLine(Date & ";" & Time & ";" & account & ";" & sourcelog & ";" & message)
objFile.Close
End Sub
In my test, This sub runs twice during the script. In the file, it actually does open the file, write a line, close, and do that again, and BOTH lines are there, so i know it appended. If I run the script again, it overwrites what the previous script wrote, but still "appends" for each sub executed during the same script process. I cannot figure out why it overwrites everytime the script is run. I have made sure the file is not being recreated, by viewing the created date property of the file. I'm stumped! From what I understand, if a file is opened up with appending, it should always leave what is in there alone, and just add whatever write or writeline arguments to the end of the file.
Note: I already tried using const ForAppending = 8, = 3, and using "false" with the same combinations.
Sub logStatus(message, account, sourcelog)
strFile = strBackupDir & strBackupFile
Set objFile = objFSO.OpenTextFile(strFile, 8, true)
objFile.WriteLine(Date & ";" & Time & ";" & account & ";" & sourcelog & ";" & message)
objFile.Close
End Sub
In my test, This sub runs twice during the script. In the file, it actually does open the file, write a line, close, and do that again, and BOTH lines are there, so i know it appended. If I run the script again, it overwrites what the previous script wrote, but still "appends" for each sub executed during the same script process. I cannot figure out why it overwrites everytime the script is run. I have made sure the file is not being recreated, by viewing the created date property of the file. I'm stumped! From what I understand, if a file is opened up with appending, it should always leave what is in there alone, and just add whatever write or writeline arguments to the end of the file.
Note: I already tried using const ForAppending = 8, = 3, and using "false" with the same combinations.