Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting only all names of Azure blob files in container?

I want all the names from the Azure Blob files in a container (for a certain purpose). I found some similar questions, even one on stackoverflow.com (getting list of names of Azure blob files in a container?). But all those answers are using the ListBlobs()-method first. That is what I want to prevent, beacause with 24,000 files, it takes about 10 minutes before all the files are stored in a list and the name is received from every file. Method I use now in C#:

            var container = GetOrCreateBlobContainer(containerName);
            var blobs = container.ListBlobs(useFlatBlobListing: true);
            var blobNames = blobs.OfType<CloudBlockBlob>().Select(b => b.Name).ToList();
            return blobNames;

What I want: Get all names directly from the storage without using container.ListBlobs() first.

Is this possible??

like image 638
E. Verdi Avatar asked Feb 04 '23 22:02

E. Verdi


1 Answers

What I want: Get all names directly from the storage without using container.ListBlobs() first.

Is this possible??

No, it is not possible. You will need to call ListBlobs to get a list of all blobs in a container.

like image 169
Gaurav Mantri Avatar answered Feb 07 '23 22:02

Gaurav Mantri