I use library pydrive for google drive. Now I need get all folders (root, parent, child) name in google drive.
I have found this:
self.drive.ListFile().GetList()
but it returns all the files. Can I get only all folders in google drive?
How about this modification? It retrieves the files with mimeType of application/vnd.google-apps.folder
using query.
application/vnd.google-apps.folder
means folders.trashed=false
means that files are retrieved from outside of the trashbox.title
means folder name.f = self.drive.ListFile({"q": "mimeType='application/vnd.google-apps.folder' and trashed=false"}).GetList()
for folder in f:
print(folder['title'])
q
If I misunderstand your question, I'm sorry.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With