Skip to end of metadata
Go to start of metadata

rsync is a program for comparing directories and copying files as a result. It can be useful for synchronization.

Because it compares first before copying things, it is much much faster that copying it you have two similar directory structures to start with.


Local update

rsync -av /path/to/source/  /different/path/to/destination

This copies the entire contents of /path/to/source into /different/path/to/destination, including subdirectories, including timestamps and permissions. This is different from

rsync -av /path/to/source  /different/path/to/destination

(note missing trailing slash) which creates a new subdirectory /different/path/to/destination/source

include acls and extended permissions

Many of our linux volumes now include access control lists (ACLs). To make sure everything is copied:

rsync -avAX /path/to/source  /different/path/to/destination

-A specifies that ACLs are to be copied, -X specifies that extended attributes are to be copied.

v for verbose

-v makes it verbose so you see a list of the files being copied.


Local update making exact copy

rsync -av --delete /path/to/source/  /different/path/to/destination

By default, don't delete

--delete is necessary to get rid of files or directories in destination that were not in source.

Copying over a network with ssh

rsync -av  -e ssh /path/to/source/

This copies the entire contents of /path/to/source into /different/path/to/destination on, authenticating as username.


Steven Karel - 16 Mar 2008