How to check if blob is directory
georgeboot opened this issue · 0 comments
georgeboot commented
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:
- my-test-directory/
-
- file1.jpg
-
- file2.jpg
-
- nested/
-
-
- file1.jpg
-
- another-directory/
-
- file1.jpg
When I run container_client.list_blobs(name_starts_with='my-test-directory/')
I somewhat expect the following blob to be listed:
- my-test-directory/file1.jpg
- my-test-directory/file2.jpg
- my-test-directory/nested/file1.jpg
However, what I am getting is the following:
- my-test-directory
- my-test-directory/file1.jpg
- my-test-directory/file2.jpg
- my-test-directory/nested
- my-test-directory/nested/file1.jpg
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?