0%

rclone挂载GoogleDrive

适用于

  • Windows[Linux]系统下使用rclone挂载GoogleDrive

特点

  • 网络运行的情况下,将GoogleDrive当硬盘使用。

准备

api_drive_enable

开始

Windows下:rclone和winfsp根据自己系统版本选择。下载winfsp 依赖库后正常安装即可,rclone 则解压到某个文件夹即可

Linux下:安装可以参考linux常用和错误集

创建配置文件过程通用,可以参考下面配置,需要手动操作的地方搜索 #

总需要输入api ID和 api token,目录文件夹,两个N即可

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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
rclone config #设置配置文件
No remotes found - make a new one
n) New remote
s) Set configuration password
q) Quit config
n/s/q> n
name> fuckbaidu #命名,记住这个后期还会用到!
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> 13 #选择GoogleDrive
** 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> xxxxxxxxxxxxx #输入刚刚得到的ID
Google Application Client Secret
Setting your own is recommended.
Enter a string value. Press Enter for the default ("").
client_secret> xxxxxxxxxxxxxxxx #输入刚刚得到的Key
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> xxxxxxxxxxxxxx #指定一个文件夹(该文件夹为URL后一个唯一串字符)
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 #选no
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?xxxxxxxxxxxx #复制这个链接后到你的浏览器打开
Log in and authorize rclone for access
Enter verification code> xxxxxxxxxx #输入验证后的字符串
Configure this as a team drive?
y) Yes
n) No
y/n> n

VBS脚本,使用方法:新建一个rclone.vbs,将下面根据自身情况修改代码粘贴即可。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
Option Explicit
Dim WMIService, Process, Processes, Flag, WS
Set WMIService = GetObject("winmgmts:{impersonationlevel=impersonate}!\\.\root\cimv2")
Set Processes = WMIService.ExecQuery("select * from win32_process")
Flag = true
for each Process in Processes
if strcomp(Process.name, "rclone.exe") = 0 then
Flag = false
exit for
end if
next
Set WMIService = nothing
if Flag then
Set WS = Wscript.CreateObject("Wscript.Shell")
'注意修改,下面的一行代码
'fuckbaidu 为配置创建的名字
':/则是指配置文件指定路径的当前文件夹,也可以修改成 :/dir1 :/dir2 等
'L: 则是值要挂载的盘符
'--cache-dir d:\tmp\rclone 顾名思义就是缓存的目录
WS.Run "rclone mount fuckbaidu:/ L: --cache-dir d:\tmp\rclone --vfs-cache-mode writes", 0
end if

会出现类似错误,那是因为没有开通Google Drive API根据给出网址打开,根据提示开通即可。

2020/03/05 13:18:23 ERROR : IO error: couldn’t list directory: googleapi: Error403: Project 916908456673 is not found and cannot be used for API calls. If it is recently created, enable Drive API by visiting https://console.developers.google.com/apis/api/drive.googleapis.com/overview?project=XXXXXX then retry. If you enabled this API recently, wait a few minutes for the action to propagateto our systems and retry., accessNotConfigured

网速测试,1m左右

参考