Moving the Google Drive folder

The thing with Google Drive is that they have a REALLY shitty API for accessing files and folders.

With Dropbox, for example, you can say upload to APPFOLDER + ‘/Backups/XYZ.zip’.

With google drive, there’s no app folder, but that’s not the worst part. The worst is that if you want to upload to say ‘/Dynalist/Backups/XYZ.zip’, you need to:

  • Query the root folder for ‘Dynalist’ Folder
  • If that doesn’t exist, create it, and get a folder id of the Dynalist folder
  • Query the ‘Dynalist’ folder for the ‘Backups’ folder
  • If that doesn’t exist, create it, and get a folder id for that
  • Create file XYZ.zip under the ‘Backups’ folder.

Now, as you can see, if you have an arbitrary folder ‘/a/b/c/d/e/f/g/XYZ.zip’, this step will be very long and very slow (because each step is a remote API call to one of Google’s servers)

One alternative I can think of, is to allow the user to specify a ‘folder id’ to drop backups in. The user will have to somehow get it from google drive, but then once that’s saved into Dynalist, we’ll try to upload files in that folder first. The advantage is that the user can move the folder anywhere even after saving the setting into Dynalist, and backups will still work. The downside is that if the folder is deleted, or anything happens to it, backups will stop rolling.

1 Like