Return code when using the put command by a VBScript

Advertisement

Guest

Return code when using the put command by a VBScript

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

Reply with quote

Advertisement

Guest

PostRe: Return code when using the put command by a VBScript

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

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
39,840
Location:
Prague, Czechia

Re: PostRe: Return code when using the put command by a VBSc

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.

Reply with quote

Guest

PostRe: PostRe: Return code when using the put command by a

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

Reply with quote

Advertisement

Advertisement

You can post new topics in this forum