Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have synchronized local and remote file using WinScp and scheduled with windows task scheduler That execute the script once in a day and download the file if the remote file is new or updated, otherwise do nothing.

Here is the script code

option include data.csv 
synchronize local d:\ /home/dir

But now What I want to do is echo the message on command prompt if the remote file is new and update and downloaded in the local directory.

The Idea behind this is the user don't have to check the file daily to see if there is new updates.

So they will be notified through this message on command prompt.

What do I add in this script to check that the newer version of file has been downloaded and echo some message otherwise do nothing?

EDIT:

Now I am here-

I created a batch file which contains the code like this:-

winscp.com /console /script=dwn_script.txt
@echo off
if errorlevel 1 goto error 
echo The new version of data.csv file has been downloaded. Please check your local disk
:error

But the errorlevel is always set to 0 in both cases when winscp says "Nothing to synchronize" and when winscp download the newer version of file.

Can anyone please clarify what variable differentiate the status "Nothing to synchronize" and successful download of file?

If I get that difference I can put it into if condition and can show the message to user that the new file has been downloaded.

share|improve this question
add comment

1 Answer

WinSCP does not distiguish scenario with no files to synchronize using exit code, as it does not consider this to be an error.

Instead, you can enable XML logging and search the log for <download> tag.
http://winscp.net/eng/docs/logging_xml

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.