Hi Would it be possible to add an option to the scp command, so that if a destination file already exists, rather than overwriting it, scp just skips the destination file, prints a message to stderr and returns an error (non-zero) exit? That would help me immensely. Also, you might want to think about providing a way to execute a series of ssh, scp and sftp commands through one authentication session, so if using password authentication you don't need to keep on re-keying the password. Maybe have some kind of background daemon, which holds the session open once authenticated, and then the ssh/scp/sftp clients connect to it to perform operations. (I know key authentication would work here, but sometimes server admins aren't so keen on key authentication, and would prefer you physically entering your password.) Cheers Simon Kissane
Simon Kissane wrote:> Would it be possible to add an option to the scp command, so that if a > destination file already exists, rather than overwriting it, scp just > skips the destination file, prints a message to stderr and returns an > error (non-zero) exit? That would help me immensely.That would require another option to be passed to the remote scp process to enable that behaviour, which would be a potential interop problem. This means it's not likely to ever happen (see http://www.openssh.com/faq.html#2.10). You can use sftp in batch mode to do it with something like: $ echo "ls /tmp/foo" | sftp -b - localhost || \ echo "put foo /tmp/foo" | sftp -b - localhost This isn't going to save you from partial transfers, however. You may be better off using rsync-over-ssh.> Also, you might want to think about providing a way to execute a > series of ssh, scp and sftp commands through one authentication > session, so if using password authentication you don't need to keep on > re-keying the password.That already exists. Check out the ControlPath and ControlMaster options in 3.9x. -- Darren Tucker (dtucker at zip.com.au) GPG key 8FF4FA69 / D9A3 86E9 7EEE AF4B B2D4 37C9 C982 80C7 8FF4 FA69 Good judgement comes with experience. Unfortunately, the experience usually comes from bad judgement.
Simon Kissane wrote:> Would it be possible to add an option to the scp command, so that if a > destination file already exists, rather than overwriting it, scp just > skips the destination file, prints a message to stderr and returns an > error (non-zero) exit? That would help me immensely.I suggest you use 'rsync' over 'ssh'. The rsync program has a many options. Look at the -u, --update option. http://rsync.samba.org Bob
Maybe Matching Threads
- [Bug 2621] New: ControlMaster started by scp (non-ssh?) doesn't forward agent
- ControlMaster, scp and current working directory
- scp fails after sending command: scp -v -t
- ssh to target, scp back to source in same session without name resolution
- Status of SCP vulnerability