Topic "script should stop if cd fails"

Author Message
colfer

Guest


I am writing a script to put files. For example,

option confirm on
open user@domain
cd /wherever
put index.html

But if the "cd" command fails, because the "/wherever" directory does not exist, then the script continues on. It then writes over the file index.html in the default directory.

My workaround is to turn on file overwrite confirmation, but I will have to look carefully that there is no error message a few lines up.

I would like a confirmation or abort after "cd" fails.

Thanks! Cool
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
Good point. Thanks for letting me know.
_________________
Martin Prikryl
colfer

Guest


I found a better workaround.

option confirm on
open user@domain
put index.html /wherever/

I did not realize "put" could specify the directory. And it does fail correctly!

Thanks again... Idea
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