Note the final / at the end to ask rsync to copy inside that path (not over it). rsync takes care of managing the ssh connection for you. The avz (typical) options ask rsync to use the archive (tar) mode, in order to copy recursively, and keep as much as possible date and user values. The v option is verbose to show you what is currently happening. The z option will zip (compress) the transfer to hopefully save time and bandwidth.
rsync is very powerful and is used by most professionals, however you may want to test it first using non valuable data to ensure the path and options match the requirements.
If you need to use rsync via SSH on a non-standard port like 2222, you can use the following command (see this article):
My favorite is
rsync
. It is smart enough to copy only what has to be copied (i.e. changed or new).Note the final
/
at the end to ask rsync to copy inside that path (not over it).rsync
takes care of managing the ssh connection for you. Theavz
(typical) options askrsync
to use the archive (tar) mode, in order to copy recursively, and keep as much as possible date and user values. Thev
option is verbose to show you what is currently happening. Thez
option will zip (compress) the transfer to hopefully save time and bandwidth.rsync
is very powerful and is used by most professionals, however you may want to test it first using non valuable data to ensure the path and options match the requirements.If you need to use rsync via SSH on a non-standard port like 2222, you can use the following command (see this article):
You're looking for a tar pipe.
I wrote an well working answer in another question. It uses SSH-Agent to move a mysql dump: Fastest way to move multiple databases to a new server
Combine this with the answer of jscott