tuna / tunasync

Mirror job management tool.
GNU General Public License v3.0
1.57k stars 272 forks source link

如何排除特定格式的文件或目录 #181

Closed iamwlb closed 8 months ago

iamwlb commented 1 year ago

比如,在同步的时候,如果不想同步.iso文件,应该如何设置?

ZenithalHourlyRate commented 1 year ago

您可以设置

exclude_file = "/path/to/exclude-file.txt"

该文件会传递给 rsync,具体语法可以参考 rsync 手册。

对于您的样例来说,该文件的内容为

*.iso
SwarmKit commented 1 year ago

有include_file 選項嗎?

SwarmKit commented 1 year ago
[[mirrors]]
name = "epel"
provider = "rsync"
upstream = "rsync://mirrors.tuna.tsinghua.edu.cn/epel/"
rsync_options = [ "--include", "7", "--include", "7/*", "--exclude", "/*" ]
use_ipv6 = false

目前使用上面的配置,是可以只同步 7 如下:

.
└── 7
    ├── aarch64
    ├── ppc64
    ├── ppc64le
    ├── source
    ├── SRPMS -> source/tree
    └── x86_64

但是我還想排除 aarch64,ppc64, ppc64le

ZenithalHourlyRate commented 1 year ago

有include_file 選項嗎?

没有该选项,参考 https://github.com/tuna/tunasync/pull/84#issuecomment-413226206

但是我還想排除 aarch64,ppc64, ppc64le

您可以参考使用如下选项

--include 『*/' --exclude '7/aarch64/**' --exclude '7/ppc64/**' --exclude '7/ppc64le/**' --include '7/**' --exclude='*'

注意这里的顺序较为重要。