Home > Software engineering >  How to get a list of entries for a directory in Google Drive?
How to get a list of entries for a directory in Google Drive?

Time:11-10

I'm migrating to Google Drive REST API (Android SDK v3) and i can't figure out how to request file system entries for a Google Drive directory assuming i have it's fileId.

I looked into REST API and i can't see how i can pass fileId. It looks like search can be used ("%fileId%" in parents), but is it actually the recommended way? Any proper way of doing that?

CodePudding user response:

In v2 there was the Children resource, which you could use to list a folder's children (there was also the Parents resource, which you could use to list a file's parents). Because this resources functionalities could be achieved with Files: list, they were dropped in v3.

So in v3, the way to list files in a folder is by using the search query, as you said, like q: 'your-folder-id' in parents.

And if you want to include all files and folders inside subfolders, refer to the thread referenced by Tanaike.

Reference:

  • Related