I'm using CentOS linux.
In one line cmd, that returns 0 if success, non-0 if failure, I need:
- Transfer a file to a remote server.
- Don't transfer the file if filename exists in remote server (return non-0)
I thought about using
rsync, but it returns 0 if the filename exists.
scp replaces the existing file, so it doesn't help me either.
A twist: The user that performs this command is not root, the files are owned by this user. The destination is owned by same user. There is an
ssh trust for root. But not for this user. Can't be prompted for password, because this command is part of an automatic script. Preliminary configuration steps are possible. I can add them as a one time configuration. Can anyone help?