10 使用rclone将OneDrive挂载到window本地
10.1 rclone下载
官网下载地址:https://rclone.org/downloads/
下载后随意解压到一个文件夹中即可
10.2 配置依赖工具winfsp
下载地址:http : //www.secfs.net/winfsp/rel/
注意:对应自己的电脑下载,64位的就下载x64的安装程序
下载后一路点击安装即可
10.3 配置环境变量
右键此电脑>属性>高级系统设置>环境变量>添加rclone解压后所在的位置
点击应用保存即可
10.4 命令行配置rclone
10.4.1 在终端输入rclone config
Microsoft Windows [版本 10.0.19043.1165]
(c) Microsoft Corporation。保留所有权利。
C:\Users\yhx19>rclone config
Current remotes:
Name Type
==== ====
onedrive_xiaoxingxing 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>
10.4.2 输入n创建新的配置
e/n/d/r/c/s/q> n
name>
10.4.3 输入一个英文名称,中间也不要有空格
name> onedrive_xjsd_xiaoxingxing
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"
省略部分
25 / Microsoft Azure Blob Storage
\ "azureblob"
26 / Microsoft OneDrive
\ "onedrive"
27 / OpenDrive
\ "opendrive"
省略部分
41 / premiumize.me
\ "premiumizeme"
42 / seafile
\ "seafile"
Storage>
10.4.4 找到配置的网盘类型OneDrive对应的数字回车
Storage> 26
** 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>
10.4.5 直接回车
client_id>
OAuth Client Secret
Leave blank normally.
Enter a string value. Press Enter for the default ("").
client_secret>
10.4.6 直接回车
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>
10.4.7 选择账号类型
全球版选择Microsoft Cloud Global对应的数字,国内世纪互联选择Azure and Office 365 operated by 21Vianet in China对应的数字
region> 1
Edit advanced config? (y/n)
y) Yes
n) No (default)
y/n>
10.4.8 选择默认配置default
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 (default)
n) No
y/n>
10.4.9 使用自动配置授权
选择自动配置之后会打开默认浏览器,登录Microsoft账号后,选择‘是’之后显示Success!即可
y/n> y
If your browser doesn't open automatically go to the following link: http://127.0.0.1:53682/auth?state=0QYNfjqPrichw8EYuh7IlA
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>
10.4.10 选择网盘的使用类型
我配置的是OneDrive Business 类型的网盘
Your choice> 1
Found 1 drives, please select the one you want to use:
0: OneDrive (business) id=b!wUAElDs_oUqwHBL1Ki3f3we8e*****HqIUC7x0C1nrSSgcVtZGESrSU9VbgqMD3
Chose drive to use:>
10.4.11 输入显示的网盘
Chose drive to use:> 0
Found drive 'root' of type 'business', URL: https://xjsd-my.sharepoint.com/personal/xiaoxingxing_xjsd_onmicrosoft_com/Documents
Is that okay?
y) Yes (default)
n) No
y/n>
10.4.12 输入default选项
y/n> y
--------------------
[onedrive_xjsd_xiaoxingxing]
type = onedrive
region = global
token = {"access_token":"此处省略一大串"2021-08-29T17:00:58.245493+08:00"}
drive_id = b!wUAElDs_oUqwHBL1Ki3f3we*********rSSgcVtZGESrSU9VbgqMD3
drive_type = business
--------------------
y) Yes this is OK (default)
e) Edit this remote
d) Delete this remote
y/e/d>
10.4.13 输入default选项
此时,就出现了刚刚配置好的网盘名称了
y/e/d> y
Current remotes:
Name Type
==== ====
onedrive_xiaoxingxing onedrive
onedrive_xjsd_xiaoxingxing 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>
10.5 挂载OneDrive为本地硬盘
注意:此处使用CMD命令挂载的话,退出命令行就没有了,所以此处使用git bash的终端执行挂载命令,git安装方法参见下方文章
使用git bash终端运行如下命令
rclone mount onedrive_xjsd_xiaoxingxing:/ X: --cache-dir H:\onedrive_xjsd_xiaoxingxing --vfs-cache-mode writes &
其中:
onedrive_xjsd_xiaoxingxing 替换为前面设置的名称
X:替换为想要挂载后硬盘的盘符号,记得不要和本地的C、D盘等其他盘重复。
H:\onedrive_xjsd_xiaoxingxing 为本地定位目录,可自行设置。
出现:rclone服务已启动则说明挂载成功,显示如下。
$ rclone mount onedrive_xjsd_xiaoxingxing:/ X: --cache-dir H:\onedrive_xjsd_xiaoxingxing --vfs-cache-mode writes &
[1] 1908
yhx19@DESKTOP-VSN7D1 MINGW64 /h/onedrive_xjsd_xiaoxingxing
$ The service rclone has been started.
输入exit就能退出git终端
到此就能在此电脑看到挂在的盘了,往里面复制文件就是上传,从里面复制文件到其他盘就是下载。如果只为暂时使用到此就可以了,下次开机使用再运行以上命即可。
10.6 设置开机自启动挂载
创建一个名称为startup_rclone的记事本文件,里面写之前的的挂载命令:
rclone mount onedrive_xjsd_xiaoxingxing:/ X: --cache-dir H:\onedrive_xjsd_xiaoxingxing --vfs-cache-mode writes &
然后另存为,保存类型为所有文件,文件名为startup_rclone.bat保存,将这个文件移动到
C:\Users\你的用户名\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
目录中,这样再开机的时候就自启动自动挂载我们之前设置的网盘啦!
创作类型:原创
本站网址:星河泪博客 https://xinghelei.top/
文章链接:https://xinghelei.top/archives/10