使用rsync -aP –exclude=web只能排除web文件/目录。
如果要排除多个文件/目录,怎么办?
那只能建一个exclude.list,里面填写要排除的目录(一行一个文件/目录),然后rsync -aP –exclude-from=“exclude.list“
如:rsync -aP –exclude-from=/root/exclude.list 192.168.1.2::web_bak/www/ /data/server/www/ (从2同步数据到本机)
补充
–exclude=PATTERN exclude files matching PATTERN
–exclude-from=FILE read exclude patterns from FILE
–include=PATTERN don’t exclude files matching PATTERN
–include-from=FILE read include patterns from FILE
http://lxsym.blog.51cto.com/1364623/831393