rsync commands

for local dir sync use:
rsync -avzP /src/foo/ /dest/foo/

rsync -avzP –exclude “/.snapshot/” tbavtm01:/opt/ /opt/
rsync -rpzvltHP -n tfladm.blah::SmarTest_5.2.3/ /local_path/

#sync directories and delete what is not on the sender’s source.
rsync -auvz -nvP –delete tbdw08:/tfl/ /nfs/disks/TBD/

# sync a specific version and subdirectories and exclude all others.
rsync -rpvlt -nvP –include “*5.4.2*/” –exclude “*[4-5].*/” tfladm.blah::SmarTest/ .

rsync -auvz -nvP for updating current files.
Can be used to ensure several directories being copy
to one have the most current files if duplicates exist.
-a archive, same a -rlptgoD
-D preserve devices (root only)
-g preserve group
-H preserve hard links
-l copysymlinks as symlynks
-L follow symlinks (copy the referent of symlinks)
-n dry run, show what would have been transferred
-o preserve owner
-p preserve permissions
-P show progress during transfer
-r recursive
-t transfer modification times along with the files
-v verbose
-z compress file data
-v, –verbose increase verbosity
-q, –quiet decrease verbosity
-c, –checksum always checksum
-a, –archive archive mode. It is a quick way of saying you want recursion and want to preserve everything.
-r, –recursive recurse into directories
-R, –relative use relative path names
-u, –update update only (don’t overwrite newer files)
-t, –times preserve times
-n, –dry-run show what would have been transferred
-W, –whole-file copy whole files, no incremental checks
-I, –ignore-times Normally rsync will skip any files that are already the same length and have the same time-stamp. Thi
s option turns off this behavior.
–existing only update files that already exist
–delete delete files that don’t exist on the sending side
–delete-after delete after transferring, not before
–force force deletion of directories even if not empty
-c, –checksum always checksum
–size-only only use file size when determining if a file should be transferred
–progress show progress during transfer
-z, –compress compress file data
–exclude=PATTERN exclude files matching PATTERN
–daemon run as a rsync daemon
–password-file=FILE get password from FILE

Bookmark the permalink.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.