HOWTO: Linux: Using rsync to transfer files
I often need to transfer files between servers to which I only have ssh access. The rsync utility is a very reliable, efficient and robust way to move files around. Here are some of the options I use.
rsync -avvz --progress --remove-sent-files --partial --partial-dir=/tmpThis setup copies the files and/or folders at ###PATHTOFILES### to your local computer. The command will preserve file permissions, group, owner, symlinks, and modification times (if applicable), will preserve partially downloaded files and allow you to restart interrupted transfers, and will remove successfully transferred files on the remote server. Here's a detailed breakdown of the options.
--rsh="ssh -p ###PORTNUMBER###" user@remoteserver:###PATHTOFILES### .
- -a
- tranfers files in archive mode, i.e. preserve permissions, group, owner, symlinks, modification times etc.
- -vv
- be very verbose (print out lots of details)
- -z
- compress files during transfer (if appropriate)
- --progress
- show a progress bar during transfers
- --remove-sent-files
- delete files from the remote server when they have been successfully transferred
- --partial
- save partially transferred files and use to resume interrupted transfers if possible
- --partial-dir=
- save partial files in this folder
- --rsh="ssh -p ###PORTNUMBER###"
- use the commandline in quotes to log into the remote server. If you're connect via ssh on its default port (22), you don't need to specify this option


