def list_file(parent):
result = service.files().list(q= "'%s' in parents and trashed=false" % parent).execute(http=decorator.http())
tasks = result.get('items', [])
for f in tasks:
if f['mimeType'] == 'application/vnd.google-apps.folder':
list_file(f['id'])
return tasks
tasks = list_file('the specific folder ID')
and the problem is that it would only return list of files and folders directly under the the specific folder ID and not the sub folders and the files in the sub folders.
anyone knows how I should fix fix my code to make it work? Thanks
or is there any better approach to list all the files and files of the sub folders under a specific folder in google drive using its API? would be great if someone can share the code.
Thanks in advance.