How to Transfer the Files With RSYNC


RSYNC can be called as a fast copy command, and it works from web hosting server to  another server as well as from directory to directory on the same server. One of the best advantages of using RSYNC is that it moves only those files which does not exist in the destination.

If there is a file which is already existing then it will skip by itself without even giving you any notification. It will help the user if the transfer is stopped before the completion and then it will be required to start again, hence there will be no time lost.



It will also be excelling with large amount of files where the scp and the ftp can struggle and it can take a long time for process. Hence it is still recommended of compressing the files into a larger file, move it and then uncompress it.

RSYNC must be installed on both the servers for it to work on both the servers. The syntax is as shown below, one must remember that in both these cases it is not the same as the syntax for cp, always keep a track of the trailing slashes or it might not work properly.

Pulling from One Server to Another Server

rsync –av This email address is being protected from spambots. You need JavaScript enabled to view it.:/home/username/public_html/ ~/public_html

Pushing it from Another web hosting to the HostingRaja server

rsync –av ~/public_html/ This email address is being protected from spambots. You need JavaScript enabled to view it.:/home2/user/public_html


One this has been entered in the command then it will be making a shell connection and will require the password for the ssh user which is listed in the command. Once it has been done it will be transferring the data.

One must be sure in noting that the use of the trailing slashes on the source directory, but not in the destination directory. You will be able to think of a trailing on the source as the meaning “copy the contents of the directory” as it has been opposed copying the directory by name. Here in both types in this case the attributes of the directory will be transferred to the containing directory on the destination.

In the examples given above the files that are located in the public_html directory or the other server of web hosting would be copied to the public_html directory on the web hosting server which will be including the attributes.

Here the -v option will be making the verbose listing all the files that have been transferred. Apart from this option it will be making the rsync run at a much faster rate, hence it will be harder in telling when will it be finished or if the right files have been transferred.

One of the another useful option of rsync is -n. This would mean a “dry run”, it will be useful with -v as it will be providing the list of the files which are actually needs to be transferred without the transfer of anything so that you will be able to check and make it sure that this is the command you require.