rsync --include选项不排除其他文件 [英] rsync --include option does not exclude other files
本文介绍了rsync --include选项不排除其他文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
尝试同步某些扩展名(* .sh)的文件,但是下面的bash脚本仍会传输所有文件,为什么?
trying to rsync files of certain extension(*.sh), but the bash script below still transfer all the files, why?
from=/home/xxx
rsync -zvr --include="*.sh" $from/* root@$host:/home/tmp/
推荐答案
您需要添加--exclude all,并且必须在--include
You need to add a --exclude all and it has to come after the --include
rsync -zvr --include="*.sh" --exclude="*" $from/* root@$host:/home/tmp/
这篇关于rsync --include选项不排除其他文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文