Hi Rakesh,
We have not heard you in days. Have you managed to write the code to delete a blob directory?
If not, I'd like to share my code for your reference:
public void RemoveBlobDirectory()
{
string containerName = "blobname";
string directoryName = "blobname/Images/14/";
var storageAccount = CloudStorageAccount.Parse("UseDevelopmentStorage=true");
var blobStorage = storageAccount.CreateCloudBlobClient();
// Ensure the container is exist.
var blobContainer = blobStorage.GetContainerReference(containerName);
blobContainer.CreateIfNotExist();
foreach (IListBlobItem item in blobStorage.ListBlobsWithPrefix(directoryName))
{
if (item.GetType() == typeof(CloudBlob) || item.GetType().BaseType == typeof(CloudBlob))
{
((CloudBlob)item).DeleteIfExists();
}
}
}
Please note that the ListBlobsWithPrefix method will scan through all blob entities in order to search the result. So it will potentially have low performance when you have large number of blobs in you storage account.
Thanks,
Wengchao Zeng
Please mark the replies as answers if they help or unmark if not.
If you have any feedback about my replies, please contact
msdnmg@microsoft.com.
Microsoft One Code Framework