阿七

  • HOME
  • CATEGORY
    • TECH
    • ENG
    • VIDEO
    • Image
    • MUSIC
  • Baidu
  • MY LIST
LOVE LASTS FOREVER
  1. Home
  2. TECH
  3. Text

rclone 使用方法 GoogleDrive,DropBox,OneDrive for Business

10/12/2017 7473Views 7Likes 0Comments

简介

rclone能够方便的管理 google drive 与 OneDrive for Business以及FTP等网盘,支持挂载盘符与命令MOVE,COPY,SYNC,MKDIR等操作。

  • 可以对硬盘进行挂载
  • 使用命令行COPY文件
  • 编写成脚本备份日志

目前喜欢上了玩PT,经常每天都要拷几百G的电影到GOOGLE DRIVE中,目前比较稳定,没有出现任何问题。
当然,在国外的机器可以和OneDrive for Business同步,快速把数据转移到国内,但要注意OneDrive for Business 目前有15G单文件的限制。

安装

官方网站是 https://rclone.org/
目前有Linux Windows OSX 等等

1
2
3
4
wget http://downloads.rclone.org/rclone-current-linux-amd64.zip
unzip rclone-current-linux-amd64.zip
cp ./rclone-*/rclone /usr/sbin/
chmod +x /usr/sbin/rclone

配置

因为OneDrive for Business用的多,所以暂时以此为例子。

1
rclone config

然后选择N) New remote 返回如下

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
1 / Amazon Drive
   \ "amazon cloud drive"
2 / Amazon S3 (also Dreamhost, Ceph, Minio)
   \ "s3"
3 / Backblaze B2
   \ "b2"
4 / Box
   \ "box"
5 / Dropbox
   \ "dropbox"
6 / Encrypt/Decrypt a remote
   \ "crypt"
7 / FTP Connection
   \ "ftp"
8 / Google Cloud Storage (this is not Google Drive)
   \ "google cloud storage"
9 / Google Drive
   \ "drive"
10 / Hubic
   \ "hubic"
11 / Local Disk
   \ "local"
12 / Microsoft Azure Blob Storage
   \ "azureblob"
13 / Microsoft OneDrive
   \ "onedrive"
14 / Openstack Swift (Rackspace Cloud Files, Memset Memstore, OVH)
   \ "swift"
15 / QingClound Object Storage
   \ "qingstor"
16 / SSH/SFTP Connection
   \ "sftp"
17 / Yandex Disk
   \ "yandex"
18 / http Connection
   \ "http"

选择13 Microsoft OneDrive,会出现。

1
2
3
4
Microsoft App Client Id - leave blank normally.
client_id>
Microsoft App Client Secret - leave blank normally.
client_secret>

这两个默认回车,直接跳过。

1
2
3
4
5
6
7
Remote config
Choose OneDrive account type?
* Say b for a OneDrive business account
* Say p for a personal OneDrive account
b) Business
p) Personal
b/p>

在此选择b Bussiness,返回

1
2
3
4
5
Use auto config?
* Say Y if not sure
* Say N if you are working on a remote or headless machine
y) Yes
n) No

此处一定要选择N,因为大多数linux没有可视窗口,然后返回。

1
2
3
4
For this to work, you will need rclone available on a machine that has a web browser available.
Execute the following on your machine:
        rclone authorize "onedrive"
Then paste the result below:

在此,需要用本机Windows下,下载rclone for windows,然后输入rclone authorize "onedrive",登录OneDrive获得result,把获得的result黏贴在这就可以了。

后续按照操作步骤,退出就OK。

常用命令

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
## 文件上传
rclone copy /home/backup gdrive:backup # 本地路径 配置名字:谷歌文件夹名字
### 文件下载
rclone copy gdrive:backup /home/backup
### 列表
rclone ls gdrive:backup
rclone lsl gdrive:backup # 比上面多一个显示上传时间
rclone lsd gdrive:backup # 只显示文件夹
### 新建文件夹
rclone mkdir gdrive:backup
### 挂载
rclone mount gdrive:mm /root/mm &
### 卸载
fusermount -u  /root/mm
 
#### 其他 ####
#### https://softlns.github.io/2016/11/28/rclone-guide/
rclone config - 以控制会话的形式添加rclone的配置,配置保存在.rclone.conf文件中。
rclone copy - 将文件从源复制到目的地址,跳过已复制完成的。
rclone sync - 将源数据同步到目的地址,只更新目的地址的数据。   –dry-run标志来检查要复制、删除的数据
rclone move - 将源数据移动到目的地址。
rclone delete - 删除指定路径下的文件内容。
rclone purge - 清空指定路径下所有文件数据。
rclone mkdir - 创建一个新目录。
rclone rmdir - 删除空目录。
rclone check - 检查源和目的地址数据是否匹配。
rclone ls - 列出指定路径下所有的文件以及文件大小和路径。
rclone lsd - 列出指定路径下所有的目录/容器/桶。
rclone lsl - 列出指定路径下所有文件以及修改时间、文件大小和路径。
rclone md5sum - 为指定路径下的所有文件产生一个md5sum文件。
rclone sha1sum - 为指定路径下的所有文件产生一个sha1sum文件。
rclone size - 获取指定路径下,文件内容的总大小。.
rclone version - 查看当前版本。
rclone cleanup - 清空remote。
rclone dedupe - 交互式查找重复文件,进行删除/重命名操作。
#### 其他 ####

其他

配置文件存储位置

1
~/.config/rclone/rclone.conf

拷贝文件到OneDrive 文件夹下

1
rclone copy ./combo.tar.gz gitod:combo/store

Licensed under 知识共享署名 4.0 国际许可协议
Tag: linux rclone
Last:04/04/2023

frank

Love Lasts Forever

Like
< PREV
NEXT >

Comment

取消回复

frank

Love Lasts Forever

New Hot Rand
New Hot Rand
好久没更新了 DirectAdmin 去掉邮件队列 Debian Directadmin 中设置 wordpress 最全的伪静态配置 vnstat 清零流量重新统计 忘记关于什么事情了 selinux DirectAdmin面板 删除log
Accelerider 坐骑 BUG/建议反馈表 美国各大学课件下载地址 VLC中文字幕乱码问题 多少的爱都不要 Ten Nararak 单词音频合成软件 T-ARA DayByDay 1080P 完整版 MV

© 2022 阿七 ALL RIGHTS RESERVED | Working

Theme Kratos Made By Seaton Jiang