Friday, July 01, 2011

Using Rsync to copy file Structure

Simple rsync copy on local filesystem:
rsync -r -t -v -l source/ dest

rsync over ssh:
rsync -r -t -v -l /path/to/dest

rsync copy shortcut to archive:
rsync -avz /path/to/dest
rsync -avz --progress /path/to/dest

rsync copy archive without caring about owner and group:
rsync -rlptD /path/to/dest
rsync -a --no-o --no-g /path/to/dest

Common Flags:
 -a = archive copy.  Equivalent to flags -rlptgoD
 -r = recursive copy
 -t = save timestamp
 -v = verbose copy
 -vv = more verbose
 -u = don't copy over existing files newer than source
 -l = preserve symlinks
 -p = preserve premissions
 -g = preserve group
 -o = preserve owner
 -D = preserve devices (superuser only)
 -z = compress transfer
 --progress = show copy progress
--delete = delete stuff on the receiving side that doesn't exist on the sending side


Anonymous said...

I would like to thank you for the efforts you've made in writing this posting. I'm hoping the same very best function from you inside future too.

CCTV karachi

Linux_Admin_Junior said...

This command is a must have trying to migrate to new servers.

Great site!