0
votes

The Python SDK for Azure provides the list_blobs method for listing blobs present in a container using a container name, prefix and a delimiter.

The Node.js based azure-cli also provides an option for listing blobs

azure storage blob list [options] [container] [prefix]

I checked the help for the above mentioned command and couldn't find an option for using a delimiter.

Is there a way for using a delimiter with the above mentioned command ?

2
Can you explain what you're trying to do? It is not very clear how you would like to use the "delimiter". - Gaurav Mantri
I'm trying to list the contents of a container so that the output appears like a directory listing. Using list_blobs from the Python SDK, this is something on these lines : list_blobs(container, delimiter="/", prefix="some_prefix/") which gives the output : some_prefix/<blob_name>/ (if the blob is a directory) - axon_synapse

2 Answers

0
votes

Is there a way for using a delimiter with the above mentioned command ?

As of today, no. There's no option to specify a delimiter when listing blobs in a blob container.

CLI Tools source code is available on Github: https://github.com/Azure/azure-xplat-cli. What you could do is raise an issue there and ask for this feature or try to implement this feature yourself. The file where you would be making changes is: https://github.com/Azure/azure-xplat-cli/blob/dev/lib/commands/storage/storage.blob._js.

0
votes

As of now, there is:

$ az storage blob list -h
...
    --delimiter                    : When the request includes this parameter, the operation returns
                                     a :class:`~azure.storage.blob.models.BlobPrefix` element in the
                                     result list that acts as a placeholder for all blobs whose
                                     names begin with the same substring up to the appearance of the
                                     delimiter character. The delimiter may be a single character or
                                     a string.
...