包含深度嵌套在排除文件夹中的文件夹

包含深度嵌套在排除文件夹中的文件夹

我试图排除使用 rsync 复制某个路径下的所有内容,但深度嵌套在其中的一个路径除外。我尝试了推荐的方法这里:

--include=/home/dave/.local/share/Steam/steamapps/common/Torchlight II/my games/
--include=/home/dave/.local/share/Steam/steamapps/common/Torchlight II/my games/**
--exclude=/home/*/.local/share/Steam/**

“我的游戏”文件夹不包含在输出中,但“Steam”文件夹是:

.d..t...... home/dave/.local/share/Steam/

我想也许我需要明确包含所需的每个子文件夹,但这也不起作用:

--include=/home/dave/.local/share/Steam/steamapps/
--include=/home/dave/.local/share/Steam/steamapps/**
--include=/home/dave/.local/share/Steam/steamapps/common/
--include=/home/dave/.local/share/Steam/steamapps/common/**
--include=/home/dave/.local/share/Steam/steamapps/common/Torchlight II/
--include=/home/dave/.local/share/Steam/steamapps/common/Torchlight II/**
--include=/home/dave/.local/share/Steam/steamapps/common/Torchlight II/my games/
--include=/home/dave/.local/share/Steam/steamapps/common/Torchlight II/my games/**
--exclude=/home/*/.local/share/Steam/**

该命令的输出包括“Steam”文件夹下除“Torchlight II”之外的所有内容。我认为问题一定是文件夹名称中的空格,但还包括其他文件夹 - 甚至是我没有特意包括的文件夹 - 例如“Super Meat Boy”。无论如何,我尝试像这样逃避它们:

--include=/home/dave/.local/share/Steam/steamapps/
--include=/home/dave/.local/share/Steam/steamapps/**
--include=/home/dave/.local/share/Steam/steamapps/common/
--include=/home/dave/.local/share/Steam/steamapps/common/**
--include=/home/dave/.local/share/Steam/steamapps/common/Torchlight\ II/
--include=/home/dave/.local/share/Steam/steamapps/common/Torchlight\ II/**
--include=/home/dave/.local/share/Steam/steamapps/common/Torchlight\ II/my\ games/
--include=/home/dave/.local/share/Steam/steamapps/common/Torchlight\ II/my\ games/**
--exclude=/home/*/.local/share/Steam/**

我也尝试引用它们:

--include=/home/dave/.local/share/Steam/steamapps/
--include=/home/dave/.local/share/Steam/steamapps/**
--include=/home/dave/.local/share/Steam/steamapps/common/
--include=/home/dave/.local/share/Steam/steamapps/common/**
--include="/home/dave/.local/share/Steam/steamapps/common/Torchlight II/"
--include="/home/dave/.local/share/Steam/steamapps/common/Torchlight II/**"
--include="/home/dave/.local/share/Steam/steamapps/common/Torchlight II/my games/"
--include="/home/dave/.local/share/Steam/steamapps/common/Torchlight II/my games/**"
--exclude=/home/*/.local/share/Steam/**

结果是一样的。对我来说完全是无稽之谈。

相关内容