Skip to content

Commit 0220214

Browse files
authored
Update storage_list_files_with_prefix.py (GoogleCloudPlatform#5747)
1 parent a927da0 commit 0220214

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

storage/cloud-client/storage_list_files_with_prefix.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,21 +37,21 @@ def list_blobs_with_prefix(bucket_name, prefix, delimiter=None):
3737
a/1.txt
3838
a/b/2.txt
3939
40-
However, if you specify prefix='a/' and delimiter='/', you'll get back:
40+
However, if you specify prefix='a/' and delimiter='/', you'll get back
41+
only the file directly under 'a/':
4142
4243
a/1.txt
4344
44-
Additionally, the same request will return blobs.prefixes populated with:
45+
As part of the response, you'll also get back a blobs.prefixes entity
46+
that lists the "subfolders" under `a/`:
4547
4648
a/b/
4749
"""
4850

4951
storage_client = storage.Client()
5052

5153
# Note: Client.list_blobs requires at least package version 1.17.0.
52-
blobs = storage_client.list_blobs(
53-
bucket_name, prefix=prefix, delimiter=delimiter
54-
)
54+
blobs = storage_client.list_blobs(bucket_name, prefix=prefix, delimiter=delimiter)
5555

5656
print("Blobs:")
5757
for blob in blobs:

0 commit comments

Comments
 (0)