On Tue, Nov 3, 2009 at 7:59 AM, Euan Thoms <[email protected]> wrote:

I don't know.
But I, personally, prefer sftp.
It works like or better than ftp, is secure, plus you can check things
by executing host commands.

With no disrespect, it doesn't work like that at all. It provides the user with a look-alike interface on the console, but what it does in execution in the kernel as well as what it sends across the wire, are radically different from standard ftp.

I've been searching for a noclobber option in scp or ssh (seeing as openssh's scp just invokes ssh anyway), but I can't find one. The closest I came was finding this page (http://www.ma.hw.ac.uk/~katie/helpfulness.html) but unfortunately in this instance "Katie's Page of Helpfulness" isn't that helpful :)

I haven't pulled the source code and searched for a noclobber option though, which might be an option to you. It could be that the functionality exists but is badly documented outside of source code.

rsync, with the right options, can be used to not to overwrite a destination file. But for various reasons rsync might not be an option for you (such as, in certain circumstances using rsync to upload to an NFS mounted directory with root_squash enabled wont work).

The original poster at http://www.unix.com/shell-programming-scripting/27312-scp-without-writting.html asks the same question as you, but gets given a script to do it with rsh (ugly). You could do that but the file (and I think the password to authenticate) will be sent over an unencrypted channel.

There is a noclobber option in the bash shell that you *might* be able to leverage on the remote system, but I'm not really sure in your circumstances if that helps. The bash noclobber option is documented at http://www.cyberciti.biz/tips/howto-keep-file-safe-from-overwriting.html

Apart from that, the only thing I can think of is that you write a script to first ssh to the remote system using the -c option to launch a command, and check that the destination file exists in the first place. If it doesn't, only then use a second command for scp to copy it to the remote system.

Still pretty ugly, but it might get the job done.

Anyway,  I hope that helps.

Regards,

Stewart
_______________________________________________
opensolaris-discuss mailing list
[email protected]

Reply via email to