利用rclone把OneDrive、GoogleDrive等网盘挂载到window本地
利用rclone把OneDrive、GoogleDrive等网盘挂载到window本地

利用rclone把OneDrive、GoogleDrive等网盘挂载到window本地

内容纲要

前言

大学4年,都最后一年才发现学校的邮箱可以白嫖1T的Onedrive网盘。而且毕业了说不定还能继续白嫖。但是每次打开网盘都需要在网页上操作,下载软件很麻烦不说,而且还可能乱备份文件,找了一些教程,可以把我们的Onedrive直接挂载到本地磁盘。

成功后你就可以看到下图。

直接免费增加1T 不多说,既然可以白嫖,不仅要白嫖到还要白嫖到爽才行。

介绍一下怎么挂载吧。

一、环境安装

1、rclone下载

官网下载:https://rclone.org/downloads/

或者你可以在GitHub下载

Github下载:https://github.com/rclone/rclone/releases

下载后解压

我这里直接解压到我的桌面

2、安装winfsp

官网下载:http://www.secfs.net/winfsp/rel/

或者

Github下载:https://github.com/billziss-gh/winfsp/releases

下载完成后安装

3、安装Git

官网地址:https://git-scm.com/downloads

下载后安装

一直下一步就行。

4、为rclone配置环境变量

  1. 点开电脑的查找输入查看高级系统设置
  2. 选择环境变量
  3. 找到刚刚解压的Rclone的路径添加进Path变量
  4. 检查rclone是否配置成功,然后按打开,当然也可以打开,输入,如果出现下面的输出则安装成功,否则检查整个步骤的环境是否配置正确。rclone --version

二、配置挂载

1、rclone配置

C:\Users\Administrator>rclone config
No remotes found - make a new one
n) New remote
s) Set configuration password
q) Quit config
n/s/q> n *//第一步:新建配置*
name> tutu
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 Providers including AWS, Alibaba, Ceph, Digital Ocean, Dreamhost, IBM COS, Minio, and Tencent COS
   \ "s3"
 5 / Backblaze B2
   \ "b2"
 6 / Box
   \ "box"
 7 / Cache a remote
   \ "cache"
 8 / Citrix Sharefile
   \ "sharefile"
 9 / Compress a remote
   \ "compress"
10 / Dropbox
   \ "dropbox"
11 / Encrypt/Decrypt a remote
   \ "crypt"
12 / Enterprise File Fabric
   \ "filefabric"
13 / FTP Connection
   \ "ftp"
14 / Google Cloud Storage (this is not Google Drive)
   \ "google cloud storage"
15 / Google Drive
   \ "drive"
16 / Google Photos
   \ "google photos"
17 / Hadoop distributed file system
   \ "hdfs"
18 / Hubic
   \ "hubic"
19 / In memory object storage system.
   \ "memory"
20 / Jottacloud
   \ "jottacloud"
21 / Koofr
   \ "koofr"
22 / Local Disk
   \ "local"
23 / Mail.ru Cloud
   \ "mailru"
24 / Mega
   \ "mega"
25 / Microsoft Azure Blob Storage
   \ "azureblob"
26 / Microsoft OneDrive
   \ "onedrive"
27 / OpenDrive
   \ "opendrive"
28 / OpenStack Swift (Rackspace Cloud Files, Memset Memstore, OVH)
   \ "swift"
29 / Pcloud
   \ "pcloud"
30 / Put.io
   \ "putio"
31 / QingCloud Object Storage
   \ "qingstor"
32 / SSH/SFTP Connection
   \ "sftp"
33 / Sugarsync
   \ "sugarsync"
34 / Tardigrade Decentralized Cloud Storage
   \ "tardigrade"
35 / Transparently chunk/split large files
   \ "chunker"
36 / Union merges the contents of several upstream fs
   \ "union"
37 / Webdav
   \ "webdav"
38 / Yandex Disk
   \ "yandex"
39 / Zoho
   \ "zoho"
40 / http Connection
   \ "http"
41 / premiumize.me
   \ "premiumizeme"
42 / seafile
   \ "seafile"
Storage> 26 *//第二步:选择26 Microsoft OneDrive*
** See help for onedrive backend at: https://rclone.org/onedrive/ **

OAuth Client Id
Leave blank normally.
Enter a string value. Press Enter for the default ("").
client_id>
OAuth Client Secret
Leave blank normally.
Enter a string value. Press Enter for the default ("").
client_secret>
Choose national cloud region for OneDrive.
Enter a string value. Press Enter for the default ("global").
Choose a number from below, or type in your own value
 1 / Microsoft Cloud Global
   \ "global"
 2 / Microsoft Cloud for US Government
   \ "us"
 3 / Microsoft Cloud Germany
   \ "de"
 4 / Azure and Office 365 operated by 21Vianet in China
   \ "cn"
region> 1 *//第三步:选择1 国际版*
Edit advanced config? (y/n)
y) Yes
n) No (default)
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 (default)
n) No
y/n> y *//第五步:输入y 使用自动配置授权*

*//输入y后会打开默认浏览器 登录Microsoft账号后 选择 是 即可*

If your browser doesn't open automatically go to the following link: http://127.0.0.1:53682/auth?state=bWBcEsbfRHRZIgcZY7Fg_w
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 / Sharepoint site name or URL (e.g. mysite or https://contoso.sharepoint.com/sites/mysite)
   \ "url"
 4 / Search for a Sharepoint site
   \ "search"
 5 / Type in driveID (advanced)
   \ "driveid"
 6 / Type in SiteID (advanced)
   \ "siteid"
 7 / Sharepoint server-relative path (advanced, e.g. /teams/hr)
   \ "path"
Your choice> 1 *//第六步:选择1 onedrive*
Found 1 drives, please select the one you want to use:
0: OneDrive (business) id=******************
Chose drive to use:> *0 //第七步:选择0: 账号ID*
Found drive 'root' of type 'business', URL: *******************
Is that okay?
y) Yes (default)
n) No
y/n> y *//第八步:选择y 获取账号root权限*
--------------------
[tutu]
type = onedrive
region = global
token = *******
drive_id = *********
drive_type = business
--------------------
y) Yes this is OK (default)
e) Edit this remote
d) Delete this remote
y/e/d> y *//第九步:选择y 确认配置*
Current remotes:

Name                 Type
====                 ====
tutu                   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 *//第十步:选择q 退出*

C:\Users\Administrator>

2、挂载OneDrive为本地硬盘

这里请使用git bash终端执行以下命令,因为我使用cmd和powershell都关闭终端后挂载程序退出、本地挂载的OneDrive的现象。如果你的windows没有安装git,请自行安装。 cmd的话,cmd是不能退出的,要保持cmd不退出本地硬盘才一直挂载着。

在 git bash 中输入以下挂载命令:

rclone mount tutu:/  Q: --cache-dir C:\onedrivecache --vfs-cache-mode writes &

其中:

  • tutu替换为你自己前面设置的名称。
  • Q: 替换为你想要挂载的硬盘后的盘符名称,不要记住和本地的C、D盘等重复。
  • C:\onedrivecache为本地缓存目录,可自行设置。

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

然后输入exit退出即可。

然后就可以看到本地一个盘,往里面复制文件就是上传,从里面复制文件到其他盘就是下载。

3、设置自启动挂载

创建一个名称为startup_rclone.bat的文件,里面的挂载命令:

rclone mount tutu:/  Q: --cache-dir C:\onedrivecache --vfs-cache-mode writes &

将这个文件搜索C:\Users\用户名\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

计算机重启后要自动挂置的云盘了,当然是因为调用是cmd所以还是不能关闭运行的cmd。下面介绍一种利用Rclone GUI进行管理的使用方法。

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注