有什么方法可以仅同步文件名中包含 _custom.conf 甚至仅自定义或 *.conf 的文件吗?
我玩过
rsync -am --include='custom' --include='*/' --exclude='*' /etc/asterisk ~/backup
和
rsync -am --include='*custom*' --include='*/' --exclude='*' /etc/asterisk ~/backup
和
rsync -am --include='*.conf' --include='*/' --exclude='*' /etc/asterisk ~/backup
但发现它们没有输出
答案1
这对我有用
$ mkdir source
$ mkdir dest
$ cd source
$ touch a.conf b.conf b.noconf custom _custom.conf
$ ls
a.conf b.conf b.noconf custom _custom.conf
$ rsync -amv --include="custom" --include="*.conf" --exclude='*' ./ ../dest/
building file list ... done
./
_custom.conf
a.conf
b.conf
custom
sent 266 bytes received 91 bytes 238.00 bytes/sec
total size is 0 speedup is 0.00
$ ls ../dest
a.conf b.conf custom _custom.conf