Interpreting SFTP success - WinSCP - XML log file

1

1

I have a BAT script on Windows 10 that invokes winscp.com and uploads a single file to SFTP server on the Internet. I log the result in an XML file. The output when the transfer is successful for a single file looks something like this.

<?xml version="1.0" encoding="UTF-8"?>
<session xmlns="http://winscp.net/schema/session/1.0" name="username@domain.com" start="2020-02-08T10:04:41.012Z">
  <upload>
    <filename value="c:\sftp\test.txt" />
    <destination value="/Data/test.txt" />
    <result success="true" />
  </upload>
  <touch>
    <filename value="/Data/test.txt" />
    <modification value="2020-02-08T03:52:28.000Z" />
    <result success="true" />
  </touch>
</session>

I can manually download the file and confirm that it's fine but by looking at the log how do I confirm that the transfer was successful?

There are two elements therein upload and touch and both have returned result success = true

What do they stand for and when is transfer actually considered successful? Should both need to be True in that case?

I am completely new to this and hence it may be a very basic query, however I do not want to download the file just to verify that transfer was successful.

My first parameter to winscp.com is the script file and second is the XML file something like /xmllog="C:\SFTP\mylog.xml"

rajeev

Posted 2020-02-08T12:36:22.917

Reputation: 1 088

Answers

0

You do not need to parse the XML log to determine, if the transfer was successful.

Simply test WinSCP exit code. WinSCP returns exit code 0 when everything went fine, otherwise it returns 1.

See also WinSCP FAQ How do I know that script completed successfully?

Martin Prikryl

Posted 2020-02-08T12:36:22.917

Reputation: 13 764