Azure / azure-storage-python

Microsoft Azure Storage Library for Python
https://azure-storage.readthedocs.io
MIT License
338 stars 240 forks source link

How to check if blob is directory #699

Closed georgeboot closed 2 years ago

georgeboot commented 2 years ago

Which service(blob, file, queue) does this issue concern?

blob

Which version of the SDK was used? Please provide the output of pip freeze.

pip freeze ``` azure-core==1.21.1 azure-storage-blob==12.8.1 azurebatchload==0.5.4 certifi==2021.10.8 cffi==1.15.0 charset-normalizer==2.0.10 cryptography==36.0.1 idna==3.3 isodate==0.6.1 msrest==0.6.21 numpy==1.22.0 oauthlib==3.1.1 pandas==1.3.5 pycparser==2.21 python-dateutil==2.8.2 python-dotenv==0.19.2 pytz==2021.3 requests==2.27.1 requests-oauthlib==1.3.0 six==1.16.0 urllib3==1.26.8 ```

What problem was encountered?

I have the following file structure in my blob container:

When I run container_client.list_blobs(name_starts_with='my-test-directory/') I somewhat expect the following blob to be listed:

However, what I am getting is the following:

As you can see, the directories are included in the blob listing as well, as if they are blobs.

How would one exclude directories from the listing, so only paths to actual blobs are returned?