Topic "Return code when using the put command by a VBScript"

Author Message
Guest




Hello,

I'm using WinSCP via a VBScript. Currently I've got the following problem:

* I'm using the PUT command to upload a file example.txt to a remote server
* when I try to upload again the same file name the already existing file example.txt
gets replaced and the return code says "Everything's fine, no errors/problems occured"

But I want to avoid that an existing file on the remote server gets overwritten and want to avoid this by checking the return code of the WinSCP call I use.

Currently I always get a return code of 0, meaning that everything was o.k.

Any ideas how to achive this???

Thank you all in advance
Joachim
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24555
Location: Prague, Czechia
You can try:
Code:
option confirm on
option batch abort
put ...

_________________
Martin Prikryl
Guest




Hello,

thank you for your support/feedback. I tried it this morning but I still get the same return code telling me that the put command succeeded even the remote file hasn't been overwritten/replaced. :=((

Best regards
Joachim
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24555
Location: Prague, Czechia
Quote:
thank you for your support/feedback. I tried it this morning but I still get the same return code telling me that the put command succeeded even the remote file hasn't been overwritten/replaced. :=((

That's true. This just prevents the file being overwritten. I suppose that this is what you need.
_________________
Martin Prikryl
Guest




Unfortunately that's not what I want to achive. I would expect a return code unequal to 0 when a command finally doesn't execute what I initially wanted the command to do

=> put command
- return code: 0; when the command really stored a file on the remote server
- return code != 0; when the command didn't store the desired file on the
remote server

- e.g. return code: 1; file could not be stored because a file with the same
name already exists on the remote server
- e.g. return code: 2; file could not be stored because the remote directory
doesn't exist
- e.g. return code: 3; file could not be stored due to invalid characters in
the file name...
- etc.

Nevertheless, thank you for your time and feedback. WinSCP is a great tool and even can get greater...

Best regards
Joachim
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24555
Location: Prague, Czechia
This issue has been added to tracker.
_________________
Martin Prikryl
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