如何使用 rsync 过滤特定的隐藏"点"文件?



我试图告诉rsync忽略我的~/.cache目录,但它不想侦听。

如何使用rsync过滤特定的点文件名?

例如,这里尝试只复制~/.cache。它也失败了。

首先,查看我的~/.cache目录的大小:

$ du -hs /home/yuzer/.cache
2.1G    /home/yuzer/.cache

这是我用"rsync"复制它的尝试:

$ sudo rsync -axvzuhhh --include='.cache' --exclude='*' "/home/yuzer" "/media/yuzer/device"
sending incremental file list
sent 18 bytes  received 12 bytes  60.00 bytes/sec total size is 0 
speedup is 0.00

您的命令看起来正确地包含了.cache,但不幸的是,它排除了其中的所有内容。

试试这个:

--include='.cache/**' --exclude='*'

最新更新