user1932923
user1932923

Reputation: 384

Get list of blobs under Virtual Directory in a Container and Azure Blobs

We have almost 100 virtual directories in a container. Now when we run the below code, it returns everything.

            foreach (IListBlobItem item in blobContainer.ListBlobs(null, false))
            {

                if (item.GetType() == typeof(CloudBlockBlob))
                {
                    CloudBlockBlob blob = (CloudBlockBlob)item;
                }
            }

I'm hoping that if there is a way to get only blobs available under a specific virtual directory?

Upvotes: 1

Views: 1020

Answers (1)

user1932923
user1932923

Reputation: 384

Ok I found the solution by digging in the SDK.

                CloudBlobDirectory blobDirectory = blobContainer.GetDirectoryReference(relativeAddress);
            blobDirectory.ListBlobs();

Upvotes: 5

Related Questions