Combine
combine
后端可以将多个远程存储合并为一个单一的目录树。
例如,你可能在某个服务提供商处有一个用于存储图片的远程存储:
$ rclone tree s3:imagesbucket
/
├── image1.jpg
└── image2.jpg
And a remote for files on another:
$ rclone tree drive:important/files
/
├── file1.txt
└── file2.txt
The combine
backend can join these together into a synthetic
directory structure like this:
$ rclone tree combined:
/
├── files
│ ├── file1.txt
│ └── file2.txt
└── images
├── image1.jpg
└── image2.jpg
你可以通过在配置中指定 upstreams
参数来实现这一点,如下所示:
upstreams = images=s3:imagesbucket files=drive:important/files
在使用 rclone config
进行初始设置时,你需要将上游远程存储以空格分隔的列表形式指定。上游远程存储可以是本地路径,也可以是其他远程存储。
配置
以下是一个为上述示例创建名为 remote
的组合远程存储的示例。首先运行:
rclone config
这将引导你完成一个交互式的设置过程:
No remotes found, make a new one?
n) New remote
s) Set configuration password
q) Quit config
n/s/q> n
name> remote
Option Storage.
Type of storage to configure.
Choose a number from below, or type in your own value.
...
XX / Combine several remotes into one
\ (combine)
...
Storage> combine
Option upstreams.
Upstreams for combining
These should be in the form
dir=remote:path dir2=remote2:path
Where before the = is specified the root directory and after is the remote to
put there.
Embedded spaces can be added using quotes
"dir=remote:path with space" "dir2=remote2:path with space"
Enter a fs.SpaceSepList value.
upstreams> images=s3:imagesbucket files=drive:important/files
Configuration complete.
Options:
- type: combine
- upstreams: images=s3:imagesbucket files=drive:important/files
Keep this "remote" remote?
y) Yes this is OK (default)
e) Edit this remote
d) Delete this remote
y/e/d> y
配置 Google Drive 共享驱动器
Rclone 提供了一个便捷功能,可将你有权限访问的所有 Google Drive 共享驱动器组合成一个后端。
假设你主(非共享)的 Google Drive 远程存储名为 drive:
,你可以运行以下命令:
rclone backend -o config drives drive:
这将生成类似如下的配置:
[My Drive]
type = alias
remote = drive,team_drive=0ABCDEF-01234567890,root_folder_id=:
[Test Drive]
type = alias
remote = drive,team_drive=0ABCDEFabcdefghijkl,root_folder_id=:
[AllDrives]
type = combine
upstreams = "My Drive=My Drive:" "Test Drive=Test Drive:"
如果你将上述配置添加到你的配置文件中(使用 rclone config file
命令查找配置文件),那么你就可以通过 AllDrives:
远程存储在一处访问所有共享驱动器。
完整信息请参阅 Google Drive 文档。
标准选项
以下是 combine
后端(将多个远程存储组合为一个)特有的标准选项。
–combine-upstreams
用于组合的上游远程存储
格式应为:
dir=remote:path dir2=remote2:path
其中,等号之前指定的是根目录,之后指定的是要放置的远程存储。
若路径中包含空格,可以使用引号:
"dir=remote:path with space" "dir2=remote2:path with space"
属性:
- 配置项:upstreams
- 环境变量:RCLONE_COMBINE_UPSTREAMS
- 类型:空格分隔列表
- 默认值:无
高级选项
以下是 combine
后端(将多个远程存储组合为一个)特有的高级选项。
–combine-description
远程存储的描述。
属性:
- 配置项:description
- 环境变量:RCLONE_COMBINE_DESCRIPTION
- 类型:字符串
- 是否必需:否
元数据
底层远程存储支持的任何元数据都会被读取和写入。
更多信息请参阅 元数据 文档。