使用软件rclone在Windows操作系统上挂载OneDrive为本地硬盘的操作方法

纸扎戏偶

1、rclone下载地址:

飘云网盘下载:http://piaoyun.online/电脑软件/上传下载/rclone
官网下载:https://rclone.org/downloads/
GitHub下载:https://github.com/ncw/rclone
另外Windows使用rclone还需要另一个依赖工具winfsp,下载地址:http://www.secfs.net/winfsp/download/



下载完成后在解压到你喜欢的文件夹下,例如我的:

2、配置环境变量


双击Path,把刚才解压到的文件路径新加到Path,比喻我的C:\Software\Tools\rclone-v1.45-windows-amd64:

3、检查rclone是否配置成功

win+X,然后按A,输入rclone --version,如果出现下面的输出则安装成功,否则重复上面步骤。

4、开始配置rclone

H:\rclone
$ 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   #输入n,创建新的远程连接
name> OneDrive   #给创建的远程连接,取个名字
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 / A stackable unification remote, which can appear to merge the contents of several remotes
   \ "union"
 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 / Dropbox
   \ "dropbox"
 9 / Encrypt/Decrypt a remote
   \ "crypt"
10 / FTP Connection
   \ "ftp"
11 / Google Cloud Storage (this is not Google Drive)
   \ "google cloud storage"
12 / Google Drive
   \ "drive"
13 / Hubic
   \ "hubic"
14 / JottaCloud
   \ "jottacloud"
15 / Koofr
   \ "koofr"
16 / Local Disk
   \ "local"
17 / Mega
   \ "mega"
18 / Microsoft Azure Blob Storage
   \ "azureblob"
19 / Microsoft OneDrive
   \ "onedrive"
20 / OpenDrive
   \ "opendrive"
21 / Openstack Swift (Rackspace Cloud Files, Memset Memstore, OVH)
   \ "swift"
22 / Pcloud
   \ "pcloud"
23 / QingCloud Object Storage
   \ "qingstor"
24 / SSH/SFTP Connection
   \ "sftp"
25 / Webdav
   \ "webdav"
26 / Yandex Disk
   \ "yandex"
27 / http Connection
   \ "http"
Storage> 19   #选择上面所列出来的网盘名称,Microsoft OneDrive 是19  我们这里就输入19
** 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>    #留空
Microsoft App Client Secret
Leave blank normally.
Enter a string value. Press Enter for the default ("").
client_secret>    #留空
Edit advanced config? (y/n)
y) Yes
n) No
y/n> 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> y   #选择y,自动配置授权
If your browser doesn't open automatically go to the following link: http://127.0.0.1:53682/auth
Log in and authorize rclone for access
Waiting for code...

If your browser doesn't open automatically go to the following link: http://127.0.0.1:53682/auth
Log in and authorize rclone for access
Waiting for code...
Got code
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  #选择1,OneDrive Personal or Business 网盘类型
Found 1 drives, please select the one you want to use:
0:  (personal) id=28acee48ba0a80c9
Chose drive to use:> 0     #注意前面的编号,一般是0.
Found drive 'root' of type 'personal', URL: https://onedrive.live.com/?cid=28acee48ba0a80c9
Is that okay?
y) Yes
n) No
y/n> y    #选择y
--------------------
[OneDrive]
type = onedrive
token = {"access_token":"EwB4A8l6BAAURSN/FHlDW5xN74t6GzbtsBBeBUYAAZr+nsbvDJvpTZnIGTclACszh9PmiR6klQruRt9oBU5AD5ReAZLULrKBbFjgQzmUJHTW1Qg9EI2zCoj+/XMlp4M0V2sraXxwnDZvP/xHtLg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Z84Q1D*Hoc2plXP2lNLLyYXeseIDzIzXF9GSKcl35vabYNK1PlNbHkn7zJULI6TEHJkvsMj3vMGG9xODHnZhhoD6r74yYxBC9G72RhIwo2n*qA!rvP7yhGShwH8RC1DxmMhUtmfBO2kpXvkAONhNG8nN9zWaGsXLXh0QDpCIu2!rLrpqH0Bi0amMocXotNGEFHrASLP583x2fpX5Da3VY*AFM18uIpsvg7i0aTj*RBZMvIV7OD02e1fAplBUmMzDodYGVelOFBKo8gd*xqZYYe7eQWaAv1SYuMBCduMcgewV71IUFw5TsdYONN5y!ewQcrv9*hhxoLI8xK7VY8VSwG8!9e21N6yLYFFHsTYZMMUOcF0LFEJmo1b29xRkShfuXXk6mxajTCn3IUbOKKP9EW","expiry":"2018-12-14T19:12:44.8939629+08:00"}
drive_id = 28acee48ba0a80c9
drive_type = personal
--------------------
y) Yes this is OK
e) Edit this remote
d) Delete this remote
y/e/d> y   #选择y
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>


到这里已经把OneDrive配置好了,选择q结束配置

注:配置文件在当前用户家目录

5、挂载OneDrive为本地硬盘

rclone mount onedrive: D:\onedrive --allow-other --vfs-cache-mode writes --allow-non-empty & //挂载文件夹的话
#onedrive就是前面第3步起的名

rclone mount onedrive:/ O: --cache-dir I:\OneDriveTemp --allow-other --vfs-cache-mode writes --allow-non-empty & //挂载盘符的话
#onedrive就是前面第3步起的名
rclone mount OneDrive:/ H: --cache-dir E:\OneDrive --vfs-cache-mode writes &

如果出现:The service rclone has been started.则说明挂载成功

上传文件到网盘,文件是先复制到缓存目录,然后再上传,等上传完成之后缓存目录的文件并不会自动删除,所以记得定时清理该目录

最后说一点,执行上面这条命令退出终端后台挂载程序也会退出,达不到我们的目的,所以在命令后面加一个&符号就行了,这样退出终端后台程序照样运行,像这样:

其他盘如GoogleDrive、DropBox等等也可以通过这种方式挂载,这样使得云端文件就像本地文件一样,只要你宽带够大,可以与本地硬盘一样无差别体验。

文章版权声明:除非注明,否则均为我爱教程术原创文章,转载或复制请以超链接形式并注明出处。