Gdrive: How to make google drive folder syncable?

Created on 22 Sep 2016  Â·  16Comments  Â·  Source: prasmussen/gdrive

I execute gdrive sync download --keep-remote --delete-extraneous --dry-run "<DIR_ID>" '/path/to/local/folder' and get:

Starting sync...
Provided id is not a sync root directory

What is a "sync root directory"? How to make a google drive directory syncable?

What is a "sync tag" mentioned in the readme? Ho can I set one?

Most helpful comment

here is what you should did:

  1. create an empty local directory: mkdir [empty_directory_name]
  2. upload the empty local directory created: gdrive upload -r [empty_directory_name]
    3.sync: gdrive sync upload [empty_directory_name] [Id_of_remote_empty_directory]

and well done, you did it.
ex:
$ mkdir test
$ gdrive upload -r test
Creating directory test
$ gdrive list -m 1
Id Name Type Size Created
1ehyF6B_H3FK3C9GVyDOpN4qImTiHkO2y test dir 2018-09-22 18:59:26
$ gdrive sync upload test 1ehyF6B_H3FK3C9GVyDOpN4qImTiHkO2y
Starting sync...
Collecting local and remote file information...
Found 0 local files and 0 remote files
Sync finished in 6.312699642s
$gdrive sync list
Id Name Created
1ehyF6B_H3FK3C9GVyDOpN4qImTiHkO2y test 2018-09-22 18:59:26

"Hope this helps"

All 16 comments

@mvasin, i have the same problem. Can you solve this problem?

Me too. How does one create a syncable directory?

It seems you will need to sync from local to drive first in order to make the drive directory syncable. And the drive directory needs to be empty before you sync upload.

First you need to make a directory for syn.For example ,run command "gdrive mkdir sync" to make a folder named "sync" on your google drive.This command will return the id of the folder "sync". ......

I not sure what's being suggested here. Do I have download my entire drive before this tool starts working? I still get the same error.

I made the folder sync with mkdir and then moved everything from my folder I wanted to sync into the new sync folder and then renamed it. So I would have the correct name and the folder would be made by the program... FAILED :(

I've created a syncable directory (_named it "syncable"_) then I tried gdrive sync upload but it didn't work.

╰─$ gdrive sync list                                                    
Id                             Name       Created
0Bz3LWCvhllF1aDEybkVWeWc   syncable   2017-06-19 22:06:39

╰─$ touch test.md; gdrive sync upload test.md 0Bz3LWCvhllF1aDEybkVWeWc
Starting sync...
Collecting local and remote file information...
Found 0 local files and 0 remote files
Sync finished in 1.166304588s

╰─$ gdrive sync content 0Bz3LWCvhllF1aDEybkVWeWc
Id   Path   Type   Size   Modified

BUMP!

Any Update?

I wasn't able to figure this out, but I found an alternate client (requires GO though) that works as expected for this task: https://github.com/odeke-em/drive

Everybody come on this tool is very useful...
https://github.com/google/skicka

here is what you should did:

  1. create an empty local directory: mkdir [empty_directory_name]
  2. upload the empty local directory created: gdrive upload -r [empty_directory_name]
    3.sync: gdrive sync upload [empty_directory_name] [Id_of_remote_empty_directory]

and well done, you did it.
ex:
$ mkdir test
$ gdrive upload -r test
Creating directory test
$ gdrive list -m 1
Id Name Type Size Created
1ehyF6B_H3FK3C9GVyDOpN4qImTiHkO2y test dir 2018-09-22 18:59:26
$ gdrive sync upload test 1ehyF6B_H3FK3C9GVyDOpN4qImTiHkO2y
Starting sync...
Collecting local and remote file information...
Found 0 local files and 0 remote files
Sync finished in 6.312699642s
$gdrive sync list
Id Name Created
1ehyF6B_H3FK3C9GVyDOpN4qImTiHkO2y test 2018-09-22 18:59:26

"Hope this helps"

These solutions aren't great because

  1. None explains what makes a directory sync-able. Importantly, is this a limitation of gdrive, or or the Google REST API? If it's the REST API, can we make the directory sync-able? If it's gdrive, can we somehow create whatever the relevant metadata are?
  2. Having to create a directory locally and upload it is really wrong -- one needs to be able to deal with existing directories, because of teamwork and sharing.

OK, it looks like there's an appProperty of "syncRoot" stored in the directories, and if that is not present, then we get this error.
Here's the code:
https://github.com/prasmussen/gdrive/blob/c3cbcceedd6beb1fcff30f06ea7be7c29558d181/drive/sync_upload.go#L126-L137

Line 126 sets the metadata property, and that we could easily do ourselves. But then there's
https://github.com/prasmussen/gdrive/blob/c3cbcceedd6beb1fcff30f06ea7be7c29558d181/drive/sync_upload.go#L131
... which I don't understand. Looks like it sets file properties on GDrive that are important to keeping the sync. But I don't see anything special being added, so maybe it's sufficient that we just set this property on the root directory and then we are able to sync.

Would agree with others this remains a useful feature. FWIW our use case is to ensure that we downloaded a very large Google Drive directory with many files on the order of GBs correctly. Thus far it sounds like suggestions are geared mostly for people uploading data, but I may be missing something here. Happy for any suggestions people might have. 😄

Was this page helpful?
0 / 5 - 0 ratings

Related issues

GaryFurash picture GaryFurash  Â·  3Comments

4getit picture 4getit  Â·  4Comments

ChrisMann89 picture ChrisMann89  Â·  5Comments

aservet1 picture aservet1  Â·  5Comments

divamgupta picture divamgupta  Â·  5Comments