rsync 排除 config.js 但包含 lib/project/config.js

rsync 排除 config.js 但包含 lib/project/config.js

我有一个这样的文件夹

/
  config.js
  /lib
    /project
      config.js

在根目录中执行 rsync

rsync -azvr --exclude config.js --include lib/project/config.js  .  dest

/lib/project/config.js目标不同步,如何解决这个问题?

答案1

您需要重新排序您的include/exclude参数

# rsync -azvr --include lib/project/config.js --exclude config.js . dest
sending incremental file list
./
lib/
lib/project/
lib/project/config.js

反而

# rsync -azvr --exclude config.js --include lib/project/config.js . dest
sending incremental file list
./
lib/
lib/project/

sent 73 bytes  received 23 bytes  192.00 bytes/sec

相关内容