小编Cur*_*ous的帖子

rsync:混合排除和包含过滤器

以下模式将 .pdf 文件从源复制到目标,工作正常。

rsync -rv --include="*.pdf" --include="*/" --exclude="*" --prune-empty-dirs /source/ ~/destination/
Run Code Online (Sandbox Code Playgroud)

但我想排除文件名中包含 web 的文件不起作用,它甚至将文件 web_profile.pdf 文件复制到目的地,为什么会这样。

rsync -rv --include="*.pdf" --include="*/" --exclude="*web*.pdf" --exclude="*" --prune-empty-dirs /source/ ~/destination/
Run Code Online (Sandbox Code Playgroud)

另外,我不清楚排除特定目录**/(即 2 星和单星)。

有人可以消除我对 rsync 中模式匹配的疑问吗?

--include="*.pdf"matches *pdf,如果我想排除某些目录,例如../web-info/..pdf,我该怎么做?

rsync

3
推荐指数
1
解决办法
2603
查看次数

标签 统计

rsync ×1