Rclone是一款的命令行工具,支持在不同对象存储、网盘间同步、上传、下载数据。
Copy rclone to:/usr/bin
一、挂载OneDrive(世纪互联)
[root@localhost ~]# chmod +x /usr/bin/rclone
[root@localhost ~]# rclone config
2020/02/20 22:24:18 NOTICE: Config file "/root/.config/rclone/rclone.conf" not found - using defaults
No remotes found - make a new one
n) New remote
s) Set configuration password
q) Quit config
n/s/q> n
name> onedrive_cn
Type of storage to configure.
Enter a string value. Press Enter for the default ("").
Choose a number from below, or type in your own value
1 / 1Fichier
\ "fichier"
2 / Alias for an existing remote
\ "alias"
3 / Amazon Drive
\ "amazon cloud drive"
4 / Amazon S3 Compliant Storage Provider (AWS, Alibaba, Ceph, Digital Ocean, Dreamhost, IBM COS, Minio, etc)
\ "s3"
5 / Backblaze B2
\ "b2"
6 / Box
\ "box"
7 / Cache a remote
\ "cache"
8 / Citrix Sharefile
\ "sharefile"
9 / Dropbox
\ "dropbox"
10 / Encrypt/Decrypt a remote
\ "crypt"
11 / FTP Connection
\ "ftp"
12 / Google Cloud Storage (this is not Google Drive)
\ "google cloud storage"
13 / Google Drive
\ "drive"
14 / Google Photos
\ "google photos"
15 / Hubic
\ "hubic"
16 / JottaCloud
\ "jottacloud"
17 / Koofr
\ "koofr"
18 / Local Disk
\ "local"
19 / Mail.ru Cloud
\ "mailru"
20 / Mega
\ "mega"
21 / Microsoft Azure Blob Storage
\ "azureblob"
22 / Microsoft OneDrive
\ "onedrive"
23 / OpenDrive
\ "opendrive"
24 / Openstack Swift (Rackspace Cloud Files, Memset Memstore, OVH)
\ "swift"
25 / Pcloud
\ "pcloud"
26 / Put.io
\ "putio"
27 / QingCloud Object Storage
\ "qingstor"
28 / SSH/SFTP Connection
\ "sftp"
29 / Transparently chunk/split large files
\ "chunker"
30 / Union merges the contents of several remotes
\ "union"
31 / Webdav
\ "webdav"
32 / Yandex Disk
\ "yandex"
33 / http Connection
\ "http"
34 / premiumize.me
\ "premiumizeme"
Storage> 22
** See help for onedrive backend at: https://rclone.org/onedrive/ **
Microsoft App Client Id
Leave blank normally.
Enter a string value. Press Enter for the default ("").
client_id> ***【CLIENT_ID】
Microsoft App Client Secret
Leave blank normally.
Enter a string value. Press Enter for the default ("").
client_secret> ***【CLIENT_SECRET】
OneDrive operated by 21Vianet (世纪互联).
Enter a boolean value (true or false). Press Enter for the default ("false").
is_21vianet_version> true
Edit advanced config? (y/n)
y) Yes
n) No
y/n> y
Chunk size to upload files with - must be multiple of 320k (327,680 bytes).
Above this size files will be chunked - must be multiple of 320k (327,680 bytes). Note
that the chunks will be buffered into memory.
Enter a size with suffix k,M,G,T. Press Enter for the default ("10M").
chunk_size>
The ID of the drive to use
Enter a string value. Press Enter for the default ("").
drive_id>
The type of the drive ( personal | business | documentLibrary )
Enter a string value. Press Enter for the default ("").
drive_type> business
Set to make OneNote files show up in directory listings.
By default rclone will hide OneNote files in directory listings because
operations like "Open" and "Update" won't work on them. But this
behaviour may also prevent you from deleting them. If you want to
delete OneNote files or otherwise want them to show up in directory
listing, set this option.
Enter a boolean value (true or false). Press Enter for the default ("false").
expose_onenote_files>
Remote config
Make sure your Redirect URL is set to "http://localhost:53682/" in your custom config.
Use auto config?
* Say Y if not sure
* Say N if you are working on a remote or headless machine
y) Yes
n) No
y/n> n
For this to work, you will need rclone available on a machine that has a web browser available.
Execute the following on your machine (same rclone version recommended) :
rclone authorize "onedrive" "6f0f7119-5423-45a0-b887-ce5038a26c3e" "CLIENT_SECRET"
Then paste the result below:
result> {"access_token":"***,"expiry":"2020-02-20T23:16:49.1852502+08:00"}
Choose a number from below, or type in an existing value
1 / OneDrive Personal or Business
\ "onedrive"
2 / Root Sharepoint site
\ "sharepoint"
3 / Type in driveID
\ "driveid"
4 / Type in SiteID
\ "siteid"
5 / Search a Sharepoint site
\ "search"
Your choice> 1
Found 1 drives, please select the one you want to use:
0: OneDrive (business) id=***
Chose drive to use:> 0
Found drive 'root' of type 'business', URL: https://***.sharepoint.cn/personal/***/Documents
Is that okay?
y) Yes
n) No
y/n> y
--------------------
[onedrive_cn]
type = onedrive
client_id = ***
client_secret = ***
is_21vianet_version = true
drive_type = business
token = {"access_token":"***,"expiry":"2020-02-20T23:16:49.1852502+08:00"}
drive_id = ***
--------------------
y) Yes this is OK
e) Edit this remote
d) Delete this remote
y/e/d> y
Current remotes:
Name Type
==== ====
onedrive_cn onedrive
e) Edit existing remote
n) New remote
d) Delete remote
r) Rename remote
c) Copy remote
s) Set configuration password
q) Quit config
e/n/d/r/c/s/q> q
[root@localhost ~]# rclone lsd onedrive_cn:
-1 2020-02-10 14:51:01 4 share
-1 2020-01-26 19:42:29 0 图片
-1 2020-02-04 09:29:10 33 应用
-1 2020-01-26 19:42:23 5 文档
-1 2020-01-26 19:42:15 11 视频
二、挂载GoogleDrive
[root@localhost ~]# rclone config
Current remotes:
Name Type
==== ====
onedrive onedrive
e) Edit existing remote
n) New remote
d) Delete remote
r) Rename remote
c) Copy remote
s) Set configuration password
q) Quit config
e/n/d/r/c/s/q> n
name> google
Type of storage to configure.
Enter a string value. Press Enter for the default ("").
Choose a number from below, or type in your own value
13 / Google Drive
\ "drive"
Storage> 13
** See help for drive backend at: https://rclone.org/drive/ **
Google Application Client Id
Setting your own is recommended.
See https://rclone.org/drive/#making-your-own-client-id for how to create your own.
If you leave this blank, it will use an internal key which is low performance.
Enter a string value. Press Enter for the default ("").
client_id>
Google Application Client Secret
Setting your own is recommended.
Enter a string value. Press Enter for the default ("").
client_secret>
Scope that rclone should use when requesting access from drive.
Enter a string value. Press Enter for the default ("").
Choose a number from below, or type in your own value
1 / Full access all files, excluding Application Data Folder.
\ "drive"
2 / Read-only access to file metadata and file contents.
\ "drive.readonly"
/ Access to files created by rclone only.
3 | These are visible in the drive website.
| File authorization is revoked when the user deauthorizes the app.
\ "drive.file"
/ Allows read and write access to the Application Data folder.
4 | This is not visible in the drive website.
\ "drive.appfolder"
/ Allows read-only access to file metadata but
5 | does not allow any access to read or download file content.
\ "drive.metadata.readonly"
scope> 1
ID of the root folder
Leave blank normally.
Fill in to access "Computers" folders (see docs), or for rclone to use
a non root folder as its starting point.
Note that if this is blank, the first time rclone runs it will fill it
in with the ID of the root folder.
Enter a string value. Press Enter for the default ("").
root_folder_id>
Service Account Credentials JSON file path
Leave blank normally.
Needed only if you want use SA instead of interactive login.
Enter a string value. Press Enter for the default ("").
service_account_file>
Edit advanced config? (y/n)
y) Yes
n) No
y/n> n
Remote config
Use auto config?
* Say Y if not sure
* Say N if you are working on a remote or headless machine
y) Yes
n) No
y/n> n
If your browser doesn't open automatically go to the following link: https://accounts.google.com/o/oauth2/auth?access_type=offline&client_id=***************
Log in and authorize rclone for access
Enter verification code> ************
Configure this as a team drive?
y) Yes
n) No
y/n> n
--------------------
[google]
type = drive
scope = drive
token = {"access_token":"***,"expiry":"2020-02-20T23:42:37.378731189+08:00"}
--------------------
y) Yes this is OK
e) Edit this remote
d) Delete this remote
y/e/d> y
Current remotes:
Name Type
==== ====
google drive
onedrive onedrive
e) Edit existing remote
n) New remote
d) Delete remote
r) Rename remote
c) Copy remote
s) Set configuration password
q) Quit config
e/n/d/r/c/s/q> q
[root@localhost ~]# rclone lsd google:
-1 2020-02-20 18:54:11 -1 视频
三、同步
避免关掉窗口进程关闭
[root@localhost ~]# yum install screen -y
拷贝GoogleDrive的A目录内容到OneDrive的B目录
[root@localhost ~]# screen rclone copy google:A onedrive_cn:B
四、其他
①rclone使用指南
https://softlns.github.io/2016/11/28/rclone-guide/
②兼容世纪互联rclone源码
https://gist.github.com/ShadeShady/81b6fecca82c289e8e5ae0637918e7e6
③预编译的 (v1.50.2)
Linux 64位: rclone-v1.50.2-linux-amd64-21vianet.zip
Linux 32位: rclone-v1.50.2-linux-386-21vianet.zip
Windows 64位: rclone-v1.50.2-windows-amd64-21vianet.zip
Windows 32位: rclone-v1.50.2-windows-386-21vianet.zip
④Windows获取世纪互联token
rclone authorize onedrive "CLIENT_ID" "CLIENT_SECRET" --onedrive-is-21vianet-version=true
⑤世纪互联 OneDrive 获取 CLIENT_ID 及 CLIENT_SECRET
https://portal.azure.cn/
Azure Active Directory
应用注册
新注册
名称:*
受支持的账户类型:任何组织目录
重定向 URL:http://localhost:53682
注册
应用程序(客户端) ID 复制
证书和密码
客户端密码 - 新建客户端密码
说明:*
截止期限:默认 一年内
添加,值复制保存
API 权限
添加权限:Microsoft Graph - 委托的权限:全部勾选
⑥增量备份:--ignore-existing
rclone copy --ignore-existing google:A onedrive_cn:B
此处评论已关闭