Bulk create remotes to existing Google Shared drives

What is the problem you are having with rclone?


I have about 40 local directories on a Windows machine. I'd like to add the equivalent Shared drives (already exist) as remotes to rclone. I know how to add them one at a time but I'm not sure how to do it bulk. I have reviewed the documentation in some of the older notes ... my script kiddle skills are struggling. Does anyone have a few examples that might help add additional context? 

What is your rclone version (output from rclone version)


v1.54.1

```


<!-- **STOP and  READ**: Are you on the latest version of rclone? You can validate by checking the version listed here: https://rclone.org/downloads/
 -->

####  Which cloud storage system are you using? (eg Google Drive)



#### The command you were trying to run (eg `rclone copy /tmp remote:tmp`)  
<!--  You should use 3 backticks to begin and end your paste to make it readable.   -->

```
Paste command here
```


#### The rclone config contents with secrets removed.  
<!--  You should use 3 backticks to begin and end your paste to make it readable.   -->

```
Paste config here
```



#### A log from the command with the `-vv` flag  
<!-- You should use 3 backticks to begin and end your paste to make it readable.  Or use a service such as https://pastebin.com or https://gist.github.com/   -->

```
Paste  log here
```

hello,

if you are able to access all the shared drives from your gdrive account, you might only need a single remote.
use --drive-team-drive
and https://rclone.org/drive/#drives
each shared drive has a unique id

not an expert at gdrive but for each remote, you would need to go thru the process of creating a token.
if you use an alias for each remote, you might be able to workaround that.

[gdrive]
type = drive
client_id = 
client_secret = 
scope = drive
token = 

[gdrive-shared-01]
type = alias
remote = gdrive:
team_drive = ID
1 Like

That isn't quite the right syntax but the idea is sound. You'd want

[gdrive]
type = drive
client_id = 
client_secret = 
scope = drive
token = 

[gdrive-shared-01]
type = alias
remote = gdrive,team_drive=ID1:

[gdrive-shared-02]
type = alias
remote = gdrive,team_drive=ID2:

You can use rclone backend drives gdrive: to list the names and IDs of the shared drives. Editing them into the right format for the config file shouldn't take too long.

1 Like

hi,
using a connection string for a remote in a config file, interesting but also confusing.

for a command on the command line, i could see the need a connection string.

but in a config file, using my example, i would have thought that
team_drive = ID would have applied to gdrive-shared-01, not gdrive and thus no need to use a connection string.
what am i missing?

The team_drive parameter applies only to the alias backend - it doesn't get passed on to the gdrive remote. It could/should maybe, but right now it doesn't.

It occurred to me that I could make an option for rclone backend drives drive: which would output in config file format with the names of the drives...

I had a go at exactly this

v1.57.0-beta.5681.c135f93dd.fix-drive-drives on branch fix-drive-drives (uploaded in 15-30 mins)

Use it like

rclone backend -o config drives gdrive:

And it will output an rclone config file configuring aliases for all your team drives.

What do you @JoeTierney and @asdffdsa think?

1 Like

i do not have a way to test it and imho, seems like a very narrow use-case.
a one-time simple copy/paste/edit would get it done.

that could be a useful feature, as connection strings syntax can be confusing for newbies.

I'm looking into this now. Thank you very much for the additional information!

Let me know how it goes @JoeTierney . It is a simple enough change that I don't mind merging it if it is useful.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.