On Wed, 4 Nov 2009, Stewart Walters wrote:

> 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
> :)

        hi Stewart, there is no no-clobber option in scp.

> 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.

        not the case, scp just opens the file without checking if it 
exists or not.

> 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.

        you can do something like this, in one command:

        cat file | ssh xxx "[ -f file ] && exit; cat >file"

        J.

-- 
Jan Pechanec
_______________________________________________
opensolaris-discuss mailing list
opensolaris-discuss@opensolaris.org

Reply via email to