Topic "Errorlevel is set to 1 when there is nothing to synchronize"

Author Message
Bascy
[View user's profile]

Joined: 2008-06-30
Posts: 13
I'm using a script to synchronize a remote dir with a local one
After executing the script I examine the errorlevel var to see if everything is alright and noticed that errorlevel is set to 1 (or higher) when synchronize says "nothing to syncrhonize"

I think this is not correct, as the execution is done correctly, no errors occured. So errorlevel should be 0 in this situation.


Dos commandfile:
Code:
winscp /console /script=WinScpPublishAM.txt /log="ftp%0.log" /parameter "%1"  >> "%LogFile%"
if errorlevel 1 set Errorsoccured=1


Winscp script: (Id info obscured)
Code:
option batch on
option confirm off
option transfer bin

option exclude */

open -timeout=120 ftp://yyyyyyy:xxxxxxxx@www.sg-partners.nl
cd htdocs/lccam
cd "%1%"
synchronize remote \\sngserver02\SNGProducts\LCCAMQM31\INTL -criteria=both
close
exit


Logging: (some info obscured)
Code:
batch           on       
confirm         off       
transfer        binary   
exclude         */       
Connecting to www.sg-partners.nl ...
Connected with www.sg-partners.nl. Waiting for welcome message...
Connected
Starting the session...
Reading remote directory...
Session started.
Active session: [1] yyyyyyyy@www.sg-partners.nl
Comparing...
Local '\\sngserver02\SNGProducts\LCCAMQM31\INTL' => Remote '/31/beta'
Nothing to synchronize.
Session 'yyyyyyyy@www.sg-partners.nl' closed.
No session.
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24512
Location: Prague, Czechia
Bascy wrote:
I'm using a script to synchronize a remote dir with a local one
After executing the script I examine the errorlevel var to see if everything is alright and noticed that errorlevel is set to 1 (or higher) when synchronize says "nothing to syncrhonize"

I do not think this is true. Are you sure that the errorlevel is 0 when there is anything to synchronize?
_________________
Martin Prikryl
Bascy
[View user's profile]

Joined: 2008-06-30
Posts: 13
Mmm, just tested it with a bare script ... and i have to agree with you
The errorlevel is not set to 1 on a "nothing to synchronize"

Guess my problem is caused by something else
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24512
Location: Prague, Czechia
So what is the difference between the two scripts?
_________________
Martin Prikryl
Bascy
[View user's profile]

Joined: 2008-06-30
Posts: 13
There was a problem with the way i gathered info about errorlevel throughout the whole script
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License