You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 31, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Mar 31, 2026. It is now read-only.
No results when delimiter is set when calling Client.list_blobs #672
from google.cloud import storage
storage_client = storage.Client()
r = storage_client.list_blobs(bucket_or_name=bucketname,prefix="match/", delimiter='/')
c = 0
for blob in r:
print(blob.name)
c+=1
if c > 5:
break
Result:
empty
Run without delimiter set:
from google.cloud import storage
storage_client = storage.Client()
r = storage_client.list_blobs(bucket_or_name=bucketname,prefix="match/",)
c = 0
for blob in r:
print(blob.name)
c+=1
if c > 5:
break
If you specify both prefix and delimiter, you'll get back only the files directly under the prefix/. As part of the response, you'll also get back an r.prefixes entity that lists the "subfolders" under the prefix/. Please refer to the API doc.
You can try adding a block of code if you want to view the subdirectories
r = storage_client.list_blobs(bucket_or_name=bucketname,prefix="match/", delimiter='/')
if r.prefixes:
print("prefixes list includes:")
for sub in r.prefixes:
print(sub)
Activity
cojenco commentedon Dec 16, 2021
Thanks for the question @ali-suleiman-44b20b39
If you specify both
prefixanddelimiter, you'll get back only the files directly under the prefix/. As part of the response, you'll also get back anr.prefixesentity that lists the "subfolders" under the prefix/. Please refer to the API doc.You can try adding a block of code if you want to view the subdirectories
ali-suleiman-44b20b39 commentedon Dec 17, 2021
I see it in the comment lines here: https://cloud.google.com/storage/docs/listing-objects#storage-list-objects-python I will try this out. Thanks
cojenco commentedon Dec 28, 2021
Great, closing the issue for now. Feel free to reopen if you have further questions. Thanks!
samples: add cloud client samples from python-docs-samples (googleapi…