Joly Joly - 19 days ago 4x
Linux Question

How to abort scp on failure using a flag?


scp 1 2 3 4 myhost:.
is there a way to specify in the scp command to abort when the first failure occurs? scp default behaviour is to continue to the next file and not to stop and of course that can be addressed programmatically however looking for more 'elegant' approach if such exists.


No. SCP is simple and old tool not made for complex and over-thinked tasks. It just works if you want to copy a file from one server to another.

If you want to accomplish more complex tasks, use rsync, which is build for reliability and flexibility.