【问题标题】:How filter specific hidden 'dot' file with rsync?如何使用 rsync 过滤特定的隐藏“点”文件?
【发布时间】:2020-11-15 10:04:44
【问题描述】:

我试图告诉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

【问题讨论】:

    标签: rsync hidden-files


    【解决方案1】:

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

    试试这个:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2010-10-16
      • 2022-06-15
      • 1970-01-01
      • 1970-01-01
      • 2012-12-18
      • 2018-12-27
      • 1970-01-01
      • 2018-10-18
      相关资源
      最近更新 更多