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

Toubi picture Toubi · May 6, 2014 · Viewed 64.2k times · Source

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();

Answer

feltocraig picture feltocraig · Nov 14, 2014

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

List<string> blobNames = list.OfType<CloudBlockBlob>().Select(b => b.Name).ToList();