Skip to content

Support Glob Pattern in list_blobs prefix  #1076

@hakan458

Description

@hakan458

Thanks for stopping by to let us know something could be better!

PLEASE READ: If you have a support contract with Google, please create an issue in the support console instead of filing on GitHub. This will ensure a timely response.

Is your feature request related to a problem? Please describe.
I want to be able to call list_blobs or something similar, using glob patterns in my prefix. Currently I can do this using gsutil on command line, but would be very helpful if its supported in the python API

Describe the solution you'd like
Want to be able to make a call like this

blobs = list(bucket.list_blobs(prefix=prefix, max_results=1))

Where prefix is a glob pattern e.g. my-dir/*/*png

Describe alternatives you've considered
Seems another library gcsfs has this support but there is no way to limit results, so the call takes a long time. Would also like to avoid making a subprocess call to use gsutil

This works well from command line for example

gsutil ls gs:/my-bucket/*/*png

Metadata

Metadata

Assignees

Labels

api: storageIssues related to the googleapis/python-storage API.priority: p2Moderately-important priority. Fix may not be included in next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions