rclone——优秀的云存储工具

经常会将文件备份在 Onedrive 和 Google drive 云盘中,但上传和下载速度却不尽人意,尤其是 Google drive。
rclone 是一个支持多个云盘与云存储的命令行工具,支持上传、下载、删除、新建等常用操作,甚至支持将云盘挂载到本地。

安装

以 CentOS 为例,使用官方提供的一键脚本

1
curl https://rclone.org/install.sh | sudo bash

配置

使用如下命令进入配置:

1
rclone config


输入n新建一个云存储,输入一个名字(后面用该名字作为盘符),选择对应的云存储服务(此处以 Google Drive 为例,目前共支持27种)

后面全部选择默认,直到
1
2
3
4
5
6
Use auto config?
* Say Y if not sure
* Say N if you are working on a remote or headless machine or Y didn't work
y) Yes
n) No
y/n>

这里选择n,打开给出的链接,同意授权并复制出verification code就好了。

Onedrive

对于服务器用户,Onedrive 的配置较为麻烦,因为其需要通过可视化浏览器打开链接拿到对应的 token。可以使用本地机器配置好之后复制配置文件到服务器,见Configuring by copying the config file

使用

1
rclone copy source:sourcepath dest:destpath

如:

1
rclone copy -P ./helloworld.py onedrive:/code/

其他命令如movedeletesyncmkdirrmdir等使用都大同小异,详细见Subcommands