Question

I saved some files in the blob, my blob file structure are :

/container/B1/1
/container/B1/2
/container/B1/3
/container/B1/4

/container/B2/1
/container/B2/2
/container/B2/3
/container/B2/4

Now i want to delete all sub blobs present in B1 blob ( i.e 1,2,3,4 ). How can i delete this?

Was it helpful?

Solution

Technically speaking, those are not "sub-blobs". Azure blob storage has two levels, containers and blobs. You actually have four distinct, unrelated blobs with the names "B1/1", "B1/2", "B1/3" and "B1/4", and you'd need to delete them individually.

If you just want to do it manually, utilities like Cerebrata Cloud Storage Studio or Cloudberry Explorer are invaluable tools.

Programmatically, each of the Storage Client APIs in the various SDKs has a wrapper for the ultimate REST call that is made. The List Blobs API does have an optional delimiter parameter to list all blobs with a given prefix, so for instance with List Blobs and a prefix of "B1/" you would get back the four blobs of interest, and then you'd issue individual deletes on them. If you're using the .NET SDK, take a look at this overload of ListBlobs for use of the BlobRequestOptions.UseFlatBlobListing option)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top