Knowledgebase

Back to Troubleshooting

How To Transfer Files With RSYNC


This article is for cPanel Accounts. Determine where your account is with this guide.

Rsync is kind of like a really fast copy command, but will work from server to server as well as from directory to directory on the same server. Another advantage is it only moves files that don’t already exist at the destination.

If the file exists and is the same, it will skip it without asking you. This helps if a transfer is stopped before completion and needs to be started again, virtually no time is lost.

It also excels with large amounts of files where scp and ftp can struggle and take a very long time, though it is still recommended to compress files into one large file, move it, and then uncompress it.

For rsync to work, however, rsync must be installed on both servers.  The syntax is as follows (please note that in many cases it is not the same as the syntax for cp, keep track of the trailing slashes or you may have a mess):

Pulling to your WestHost server from another WestHost server:
rsync –av user@otherdomain.com:/home/username/public_html/  ~/public_html

Pushing from another host to your WestHost server:
rsync –av ~/public_html/ user@westhostdomain.com:/home2/user/public_html

Once you have entered in the command it will make a shell connection and require the password for the SSH user listed in the command.  Once it has that it will begin transferring the data.

**Be sure to note the use of trailing slashes on the source directory, but not the destination directory. You can think of a trailing / on a source as meaning "copy the contents of this directory" as opposed to "copy the directory by name", but in both cases, the attributes of the containing directory are transferred to the containing directory on the destination.

In both of the above examples, all of the files located in the public_html directory of the other server would be copied to the public_html directory on the WestHost server including attributes.

The –v option makes it verbose listing all files that are transferred. Excluding this option will make rsync run much faster, but it is harder to tell when it is finished or if the right files are being transferred.

Another useful option of rsync is –n. This means “dry run”, it is only useful to use this with –v as all it will do is provide a list of the files that will be transferred without transferring anything so you can check to make sure the command is what you want.

Further information can be found at http://www.samba.org/ftp/rsync/rsync.html



Related Articles

My Emails I Send Are Being Received In The Junk Folder
Can I Backup My Outlook Mail Data
How To Change An Email Account Password
How To Change An Email Forwarder Into Full Email Account
How To Create An Email Account

Can’t Find what you need?

No worries, Our experts are here to help.