rsync
2013-03-21.
Category & Tags:
Soft&Skills
Soft&Skills
Usage:
# general usage:
rsync -avhuzP /path/to/src_folder/ username@serverIp:/home/username/path/to/dest_folder/
# other usages:
alias rsyncBackupCompareAttr='rsync -avhuz --progress --delete --log-file=rsyncBackupLog.txt'
alias rsyncBackupIgnoreAttr='rsync -avhuz --no-perms --no-owner --no-group --progress --delete --log-file=rsyncBackupLog.txt'
-a
: archive mode is -rlptgoD
(no -A,-X,-U,-N,-H).
-v
: == --verbose
.
-h
: human-readable.
-u
: transfer only if src has (newer timestamp) or (equal timestamp & different size).
-z
: == --compress
during transfer.
-P
: == --partial --progress
.
--partial
: keep partially transfered files in dest (will overwrite/delete.&.re-transfer by default).
OBS:
rsync folderA folderB
will cp folderA into,under folderB.
rsync folderA/ folderB/
will cp folderA’s content into folderB.
Thus, /
s after both folderX
are mandatory.
Becareful with -u
: it will ignore the dest file with newer timestamp.