File Synchronization with rsync

Microsoft SyncToy is a very helpful tool for 1-way or 2-way file synchonization. But it hasn’t been updated since 2009 and of course its not for Linux 🙂

rsync

Its a very good command based tool which can get the 1-way file synchonization done neatly (the logo does look unprofessional but this tool isn’t).

Installing rsync on Ubuntu

It is by default installed on Ubuntu (tested on both 12.04 and 12.10 distributions) but incase it isn’t, then run the following command:

sudo apt-get install rsync

Structure of rsync command

Following is the structure of the simple yet powerful rsync command:

rsync [options] [source-folder] [destination-folder]

Possible options

  • -a or –archive can be used for archive which means timestamps and ownerships will be retained.
  • -z or –compress can be used for compress mode which means bandwidth can be saved but CPU power will be consumed
  • -v or –verbose can be used to display information when rync is transfering, otherwise it does so silently.
  • -n or –dry-run can be used to display what will happen if this rync command is executed. No changes will take place
  • –progress does what the name says. It will display the %age, transfer rate etc.
  • –size-only will compare files based on their size instead of hashes. This way less CPU power is will consumed.
  • –delete will delete all the files from the destination folder that are not present in the source folder.

Source and Destination Folders

The trailing slash / at the end of the destination is important.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s