My goal is as follows:
Write log data to a file called log.txt on a Windows server
Automatically upload log.txt to a remote SFTP server using WinSCP triggered by a timed event
Once the file is uploaded, a process on the remote server will automatically grab and delete the remote log.txt file
After upload, the local script will delete the log.txt file on the Windows machine
The process I listed above can be handled easily but, if the remote process has NOT grabbed and deleted the log.txt file before the local process is automatically triggered again, I will overwrite the remote file, causing data loss.
If the remote log.txt file already exists on the SFTP server, I need to be able to append whatever new data is contained in the log.txt file on the local Windows machine to the existing log.txt file on the remote server.
log.txt file on remote server contains:
log.txt on the local server contains:
I want to append the data from the local file I am sending to the remote file so the end result is a log.txt file on the remote server that contains:
I hope I explained this clearly.
I have been digging around in the forums for an answer and I see instructions that get me close but I am hoping somebody can clearly document the steps I need to take to make this happen.
Thank you for your time and I look forward to your answer.