0

I'm trying to programmatically offer a way to view and enumerate the folder structure of a Google Drive Backup and sync folder. In my case "My Laptop".

All I've come up with is ways involving searching up files hopefully contained there then crawling up the parents hierarchy to find the root id of the backup and sync folder. One such suggestion can be found here.

Is there a better way?

  • So, you want to search through all folders contained in a Drive folder? Would this be helpful to you? https://stackoverflow.com/a/62655764 – Iamblichus Sep 14 '20 at 11:43
  • If I understand the example correctly it seems that the author begins with a given ID to work off of. I have no id to start with, and what i'm looking for is not a child directory of the 'root' special folder. – Gunnar Már Óttarsson Sep 16 '20 at 16:44
  • Sorry I misunderstood your question. I think both workarounds specified in the post you referenced are quite appropriate in this case, and don't involve "crawling up the parents hierarchy". The first one only involves a call to [Files: list](https://developers.google.com/drive/api/v3/reference/files/list) and then filtering the results according to `parents[] = null` and `capabilities.canShare = false`. As I see it, it's not a specially complex process, and I don't think there is a better way. Have you tried that? – Iamblichus Sep 17 '20 at 13:11
  • I haven't but i have faith in it. I am worried though that it might break if google change their backup & sync api in the slightest. – Gunnar Már Óttarsson Sep 18 '20 at 20:34
  • Drive API does not have a special method to retrieve this folder, so I suggest you to follow any of the workarounds you referenced. – Iamblichus Sep 21 '20 at 09:02
  • I'm keeping the question open though in case the API gets updated at a later date – Gunnar Már Óttarsson Sep 22 '20 at 13:59

0 Answers0