14th Jan2013
Author: Gyro

Using rsync to backup a remote folder onto your computer via SSH

I've been having a hard time remembering the correct way of doing this, so I figured I write it down…

Backup the "folder":
# rsync -avz -e ssh [email protected]:/some/folder/ /backup/some/folder/

When using a different ssh port (xxxx is the ssh port number):
# rsync -avz -e ‘ssh -p xxxx' [email protected]:/some/folder/ /backup/some/folder/

When there is a space in the folder name, you need to put single or double quotes around the folder name:
# rsync -avz -e ssh [email protected]:/some/folder/'with a lot of spaces'/ /backup/some/folder/'with a lot of spaces'/

Some cool commands you can add:

will remove files from the destination folder that are not present in the origin

shows a nice % progress on the current file

# rsync -avz -e --delete --progress ssh [email protected]:/some/folder/'with a lot of spaces'/ /backup/some/folder/'with a lot of spaces'/
This will download the content of the remote folder with a lot of spaces to your local machine with a folder of the same name, while deleting any file that is inside your local folder and not in the remote folder, and it will give you some details to the files being downloaded.


Keep Me Going

Your Name / Website :

Did you like my post? Buy me a Bitcoffee! 14JX52Li7zTKbyQv2omw4tvu6Bi1KzfHNW

Leave a Reply

Your email address will not be published. Required fields are marked *

What is 10 + 7 ?
Please leave these two fields as-is:
IMPORTANT! To be able to proceed, you need to solve the following simple math (so we know that you are a human) :-)