Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?


Now I am here-

I created a batch file which contains the code like this:- /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

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

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.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .