【发布时间】:2021-05-10 02:36:57
【问题描述】:
我正在使用 Google Cloud Storage Python API 来收集 Cloud Storage 中特定子目录中包含的文件列表。
bucket.list_blobs(prefix='abc')
但是,问题在于我只想收集其中的文件列表:
桶/abc/
但是,被调用的是:
桶/abc/ 和 桶/abc-123/
如何确保前缀被用作完全匹配?谢谢。
【问题讨论】:
-
您只想要直接位于
bucket/abc下的blob吗?子目录中什么也没有? -
我想要 bucket/abc 中所有子目录中的所有 blob。例如。 bucket/abc/1/、bucket/abc/2/、bucket/abc/3/、bucket/abc/test.txt 都应该列出它们的 blob。
标签: python python-3.x google-cloud-platform google-cloud-storage