Command Line

Rsync to Sync Folders

In this post, I changed the default port to SSH into my server, which means that I won’t be able to run the rsync command to synchronise my folders between my local computer and my server the usual way.

To take into account the new port number, add --rsh='ssh -p 64000' option into your rsync command. This is my resulting command to synchronise the src_folder from my local computer to the dest_folder in my server:
rsync --rsh='ssh -p 64000' --progress -r -c ./local_folder luvelle@my-ip-address:remote_folder

The --progress option is useful as it allows you to track the progress of each file in the folder.

The -r option allows you to synchronise (recursively) all items in your folder.

I like the -c option as it will synchronise based on checksums instead of modified time and size.

To synchronise folders out of your server to your local machine, just exchange the position of the last 2 arguments in the above rsync command:
rsync --rsh='ssh -p 64000' --progress -r -c luvelle@my-ip-address:remote_folder/local_folder .

Leave a Reply

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