Folders in azure storage account are not deleted even after all blobs of the folders are deleted

SIGMA P35 1 Reputation point
2023-01-13T08:51:11.78+00:00
I have a blob container in Azure called UploadedFiles. It has folders and the folder has some blobs. Even after all the blobs are deleted,the folder is still visible. How that folder will disappear?

CloudBlobDirectory directory = GetContainerHandle(eContainer).GetDirectoryReference(strVirtualDirectory);

foreach (CloudBlockBlob blockBlob in directory.ListBlobs()) {
    blockBlob.Delete();           
}
Azure Storage Accounts
Azure Storage Accounts
Globally unique resources that provide access to data management services and serve as the parent namespace for the services.
3,269 questions
Azure Blob Storage
Azure Blob Storage
An Azure service that stores unstructured data in the cloud as blobs.
2,978 questions
{count} votes

1 answer

Sort by: Most helpful
  1. SaiKishor-MSFT 17,236 Reputation points
    2023-01-17T07:14:53.5733333+00:00

    @SIGMA P35 Thank you for reaching out to Microsoft Q&A. I understand that you are having issues where after deleting all the Blobs insider a container, the container stays in the account, is that right?

    Deleting the Blobs does not delete the container automatically, you will need to delete the container manually-

    [https://learn.microsoft.com/en-us/dotnet/api/azure.storage.blobs.blobcontainerclient.delete?view=azure-dotnet

    Is this what you are looking for? Please do let me know. Thank you!


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.