Syncing all Google Drive folders - owned and shared

What is the problem you are having with rclone?

I want to sync all the folders in my Google Drive - all the ones I own and the ones which have been shared with me. However, rclone sync only seems to sync owned folders or shared folders, but not both at the same time.

What is your rclone version (output from rclone version)

rclone v1.50.2
- os/arch: linux/amd64
- go version: go1.13.6

This is the latest version available in the Ubuntu package archives, installed with apt install rclone.

Which OS you are using and how many bits (eg Windows 7, 64 bit)

Ubuntu 20.04, 64 bit

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

Google Drive

The command you were trying to run (eg rclone copy /tmp remote:tmp)

rclone sync --verbose rclone-drive-id: ~/backups/google-drive/
rclone sync --verbose --drive-shared-with-me rclone-drive-id: ~/backups/google-drive/

The first command syncs all the folders that I own. The second command syncs all the folders that have been shared with me, but deletes the local copies of all the folders I own (which I expect, since the local copies don't exist on the remote I've specified).

If I run the same commands but with ls instead of sync, the first command lists only the files I own and the second only the files that have been shared with me.

Because of the way sync works, I need to get owned and shared files in the same command, otherwise some files will be deleted.

All the owned and shared files were created via the Google Drive interface - I only use rclone to keep a local backup (hence the drive.readonly scope in my config below).

The rclone config contents with secrets removed.

{
  "rclone-drive-id": {
        "client_id": "my-client-id",
        "client_secret": "my-client-secret",
        "root_folder_id": "my-root-folder",
        "scope": "drive.readonly",
        "token": "{\"access_token\":\"my-access-token\",\"token_type\":\"Bearer\",\"refresh_token\":\"my-refresh-token\",\"expiry\":\"2021-03-05T17:11:46.978889034Z\"}",
        "type": "drive"
    }
}

I am using my own client ID and client secret from an app I created via the Google API Console as per the Google Drive instructions page.

A log from the command with the -vv flag

Can't include this log as the filenames contain sensitive data.

hello and welcome to the forum,

that version is very old.
you can update here
https://rclone.org/downloads/#script-download-and-install

By default, that is how sync works.

You could make a union of the two together and just sync that.

1 Like

Do you mean the latest version supports what I want? If not then there is not much point updating, and I will lose security updates provided by Ubuntu.

Unions seem to be for two different remotes, but I want everything from the same remote. Is that possible? I can't see anything on the union page that explains how to union 'owned files on remote' and 'shared files on remote'.

Union is for anything.

You make a union of your first , your shared and copy that union to your final destination.

Okay, I don't really want to have three configs (owned, shared, union) for every Google Drive I backup as that quickly gets out of control. I think I'll just workaround it by creating owned and shared folders locally and run sync twice with different local targets, as that keeps a single config per drive.

Thanks for your help anyway.

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