小编use*_*413的帖子

rsync 使用正则表达式只包含一些文件

我正在尝试运行 rsync 以根据文件名模式(不区分大小写)沿路径递归复制一些文件。这是我为运行 rsync 所做的:

$ rsync -avvz --include ='*/' --include='.*[Nn][Aa][Mm][E].*' --exclude='*' ./a/ ./b/
Run Code Online (Sandbox Code Playgroud)

没有被复制,调试输出显示:

[sender] hiding file 1Name.txt because of pattern *
[sender] hiding file 1.txt because of pattern *
[sender] hiding file 2.txt because of pattern *
[sender] hiding file Name1.txt because of pattern *
[sender] hiding directory test1 because of pattern *
[sender] hiding file NaMe.txt because of pattern *
Run Code Online (Sandbox Code Playgroud)

我试过使用: --include='*[Nn][Aa][Mm][E]*'和其他组合,但还是不行。

关于如何使用正则表达式包含一些文件的任何想法?

linux backup shell rsync regex

14
推荐指数
2
解决办法
4万
查看次数

标签 统计

backup ×1

linux ×1

regex ×1

rsync ×1

shell ×1