How to not copy but move files from one server to another (both Linux)?
man scp didn't give me anything useful. I cannot use 'scp' then 'rm' because I must make sure the file is successfully transferred. If there is any error during transfer, the file must not be deleted.
Perhaps I should use exit code somehow, but how? Also, there are a lot of files, and if the last file fails it would be not-so-good option keep the whole bunch of successfully transferred files.
Maybe there is something besides SCP?
-e sshis the implicit default for many years now, there is usually no need to use this parameter anymore. – Sven Feb 26 '12 at 20:21smv() { rsync -az --remove-source-files "$@"; }to my toolbox. Thank you. – Rhys Ulerich Jun 03 '14 at 16:13-e sshis still useful for passing a specific authentication key-e "ssh -i mykey.pem"– k_o_ Jun 05 '21 at 02:02