Rclone & G Drive Service Account Setup

Greetings,

This is my first time working with rclone so bear with me!

I work for a K-12 school and want to be able to upload our graduates' H: drives to their Google Drive - H: drive being their personal network folder that is on one of our Windows file servers. We are a G Suite school so I have gone through the steps to create a project, the service account, downloaded the json file, and put in the API client access for the service account in our Admin Console.

Interestingly, the option "Enable G Suite Domain-wide Delegation" wasn't present when I created the service account. However, when I go to the service account in the project, I can click on the View Domain Wide Delegation Client ID button so I believe this account has the permissions/access is needs as I used the ID number to setup the API client access to the https://www.googleapis.com/auth/drive scope.

I then ran the rclone config command on the file server and created the remote. Here are the contents of the config file:
[gdrive]
type = drive
scope = drive
service_account_file = c:\temp\rclone\rclone-project-XXXXXX-XX2XXXXXXXXXX.json

I then tried to verify it works with the command "rclone -v --drive-impersonate tstudent@domain.com lsf gdrive:archive" (the Archive folder does exist in this test student's Drive) but it gave me these 2 errors:
2019/06/20 09:43:02 ERROR : : error listing: directory not found
2019/06/20 09:43:02 Failed to lsf with 2 errors: last error was: error in ListJSON: directory not found

I'm not sure where to go from here so any assistance would be greatly appreciated. I am using v1.48.0 of rclone for Windows (downloaded it yesterday).

Thanks!

Can you list (lsf) any files if you start from the root gdrive:?

Nick,

Running the command "rclone -v --drive-impersonate tstudent@domain.com lsf gdrive:" does work - it listed the contents. I reran the previous command and it gave me the same errors...however the archive folder is actually spelled Archive with a capital 'A' so I tried "rclone -v --drive-impersonate tstudent@domain.com lsf gdrive:Archive" and that worked. I didn't realize it was case-sensitive!

So, now that I know that rclone can access the drives, what would be the proper syntax to upload a local folder from the server to the test student's Archive folder in Google Drive? Would that be something like "rclone --drive-impersonate tstudent@domain.com copy E:\Misc\tstudent gdrive:Archive" with E:\Misc\tstudent being the test student's H: drive folder on the server?

Thanks!

Great! Yes google drive is case sensitive as in you can have a file called "hello.txt" and another called "HELLO.txt" in the same directory.

rclone --drive-impersonate tstudent@domain.com copy E:\Misc\tstudent gdrive:Archive

I would say that is exactly right! If you have a lot big files and a reasonable amount of memory then increasing --drive-chunk-size will make things go faster.

Note that uploading lots of small files takes a loooong time with Google drive.

You might want to add -P if you are running interactively to see what is going on, or -v if you want to see the files being transferred. If using -v you could use --log-file to store the results in a file for review later.

Nick,

Yep, that command to upload the test student's local folder to their G Drive worked perfectly! I took a look and their is a whole bunch of folders and files in the Archive folder I created.

Thanks for the info regarding the various command switches I can use. I've done some reading about those but it's nice to have some more context.

Rclone is a great tool and I really appreciate being able to use it!

1 Like

Thank you and good luck :slight_smile:

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