Script for checking WinSCP Sync or Not

Advertisement

HumbleSage
Joined:
Posts:
2
Location:
USA

Script for checking WinSCP Sync or Not

Hey, love this program. I need a little help with a script I have that performs a sync with a size against a local file and only performs the transfer and sends an email if a sync occurs, otherwise it should do nothing.

In my cmd file:
2batch2
winscp /ini=nul /script="C:\scripts\sync.script"
In my sync.script:
open sftp://<site> -hostkey="<key info>"
synchronize local -resumesupport=on -filemask=file.zip c:\scripts\ /
close
bye
Results:
FTP and compare files, download if different...
Searching for host...
Connecting to host...
Authenticating...
Using username "<user>".
Authenticating with pre-entered password.
Authenticated.
Starting the session...
Session started.
Active session: [1] <site>
Comparing...
Local 'c:\scripts\OlderFiles' <= Remote '/OlderFiles'
Nothing to synchronize.
Session '<site>' closed.
No session.
It executes correctly with ERRORLEVEL 0 but does WinSCP provide an exit code to compare if there was "Nothing to synchronize."? I need this so I can perform a following IF statement against it to determine to copy the file/send email/etc.. or do nothing. Help appreciated in advance. Thanks. :)

Reply with quote

Advertisement

Advertisement

You can post new topics in this forum