在特定文件夹中获取可共享的 link 个云端硬盘文件,共 Google 个
Get shareable link of Google Drive files in a specific folder
我一直在尝试应用 , adapting from the PyDrive documentation 中描述的解决方案。我想要的是处理特定文件夹中的文件,而不是获取我的驱动器中所有文件的列表(其中包含数千个)。所以我试过了:
files = drive.ListFile({'q': "'myfolder' in parents"}).GetList()
其中 myfolder
是我要从中获取此列表的文件夹的名称。然而,这 returns 一个 HTTP 404 错误。将 myfolder
替换为 root
可行(根据 Google's example),但需要很长时间(所以我的语法是正确的,但我可能误解了 parents
代表什么)。
有人能帮忙吗?
我实际上快到了:我需要在查询中传递文件夹 ID 而不是名称:
files = drive.ListFile({'q': "'folder_id' in parents"}).GetList()
从那里,我得到了一个字典集合,从中可以很容易地获取文件名(title
键)和可共享的 link(alternateLink
)。
我一直在尝试应用
files = drive.ListFile({'q': "'myfolder' in parents"}).GetList()
其中 myfolder
是我要从中获取此列表的文件夹的名称。然而,这 returns 一个 HTTP 404 错误。将 myfolder
替换为 root
可行(根据 Google's example),但需要很长时间(所以我的语法是正确的,但我可能误解了 parents
代表什么)。
有人能帮忙吗?
我实际上快到了:我需要在查询中传递文件夹 ID 而不是名称:
files = drive.ListFile({'q': "'folder_id' in parents"}).GetList()
从那里,我得到了一个字典集合,从中可以很容易地获取文件名(title
键)和可共享的 link(alternateLink
)。