目录接口/opt|--build||--bin||--res||--image|--bin|--conf我想/opt下面所有文件(排除/opt/bin这个目录)上传到远程服务器rsync-avzP--progress--delete-r--exclude='bin/'/opt/192.168.0.100:/opt这样build文件夹下的bin目录也会排除掉,如何只排除/opt/bin呢?
2 回答
心有法竹
TA贡献1866条经验 获得超5个赞
rsync-avzP--progress--delete-r--exclude='/bin/'--exclude='./uploads/'/opt/192.168.0.100:/optifthepatternstartswitha/thenitisanchoredtoaparticularspotinthehierarchyoffiles,otherwiseitismatchedagainsttheendofthepathname.Thisissimilartoaleading^inregularexpressions.Thus"/foo"wouldmatchanameof"foo"ateitherthe"rootofthetransfer"(foraglobalrule)orinthemerge-file’sdirectory(foraper-directoryrule).Anunquali‐fied"foo"wouldmatchanameof"foo"anywhereinthetreebecausethealgorithmisappliedrecursivelyfromthetopdown;itbehavesasifeachpathcomponentgetsaturnatbeingtheendofthefilename.Eventheunanchored"sub/foo"wouldmatchatanypointinthehierarchywherea"foo"wasfoundwithinadirectorynamed"sub".SeethesectiononANCHORINGINCLUDE/EXCLUDEPATTERNSforafulldiscussionofhowtospecifyapatternthatmatchesattherootofthetransfer.
子衿沉夜
TA贡献1828条经验 获得超3个赞
--exclude='./bin/'啊,建议单独写一个exclude.list,把需要排除的文件和目录写在里面,一行一条,可以使用通配符,也可以写具体匹配的路径。rsync-avzP--delete--exclude-from=exclude.list
添加回答
举报
0/150
提交
取消