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
We can get some additional info like Size, Modified date and Name.
CloudStorageAccount backupStorageAccount = CloudStorageAccount.Parse(YOUR_CON_STRING);
var backupBlobClient = backupStorageAccount.CreateCloudBlobClient();
var backupContainer = backupBlobClient.GetContainerReference("CONTAINER");
var blobs = backupContainer.ListBlobs().OfType().ToList();
foreach (var blob in blobs)
{
string bName = blob.Name;
long bSize = blob.Properties.Length;
string bModifiedOn = blob.Properties.LastModified.ToString();
}
Also you can download a specific file by Name.
// Download file by Name
string fileName = "Your_file_name";
CloudBlockBlob blobFile = backupContainer.GetBlockBlobReference(fileName);
blobFile.DownloadToFile(@"d:\"+ fileName, System.IO.FileMode.Create);