Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting list of names of Azure blob files in a container?

I need to list names of Azure Blob file names. Currently I m able to list all files with URL but I just need list of names. I want to avoid parsing names. Can you please see my below code and guide:

CloudStorageAccount backupStorageAccount = CloudStorageAccount.Parse(blobConectionString);  var backupBlobClient = backupStorageAccount.CreateCloudBlobClient(); var backupContainer = backupBlobClient.GetContainerReference(container);  var list = backupContainer.ListBlobs(); 
like image 780
Toubi Avatar asked May 06 '14 03:05

Toubi


People also ask

What does List_blobs return?

The List Blobs operation returns a list of the blobs under the specified container.


1 Answers

If you're using Windows Azure Storage 4.3.0, try this code.

List<string> blobNames = list.OfType<CloudBlockBlob>().Select(b => b.Name).ToList(); 
like image 133
feltocraig Avatar answered Sep 22 '22 02:09

feltocraig