具体的命令参数可以参看 http://man.linuxde.net/rsync 或者man rsync
这里我们结合实际使用来看几个命令
rsync -av -f"+ */" -f"- *" /root/temp/nfs /root/temp/mybackup 是只备份 source /root/temp/nfs 下的目录。
rsync -av /root/temp/nfs /root/temp/mybackup 是备份 source /root/temp/nfs 下的所有文件。
-f 后面跟的是过滤规则
exclude, - specifies an exclude pattern.
include, + specifies an include pattern.
merge, . specifies a merge-file to read for more rules.
dir-merge, : specifies a per-directory merge-file.
hide, H specifies a pattern for hiding files from the transfer.
show, S files that match the pattern are not hidden.
protect, P specifies a pattern for protecting files from dele-
tion.
risk, R files that match the pattern are not protected.
clear, ! clears the current include/exclude list (takes no arg)