How do I find an Azure Storage Blob by suffix name without listing the entire container?
Having a lot of blobs inside Azure virtual directories:
VirtualDirectory1/file1 VirtualDirectory1/file2 ... VirtualDirectory1/fileN ... VirtualDirectoryK/file1 VirtualDirectoryK/file2 ... VirtualDirectoryK/fileM
I need a quick way to find all blobs that end with a specific suffix (for example, "file1"). As far as prefixes go, there is a way to only get blobs that start with some name:
blobContainer.ListBlobs(prefix: "prefixHere")
The following approach to extract blobs with a specific suffix leads to the selection of a full container and filtering it on the client.
var blobsFound =
blobContainer
.ListBlobs(useFlatBlobListing: true)
.OfType<ICloudBlob>()
.Where(b => b.Name.EndsWith("file1"))
.ToList();
With the help of Fiddler, it was possible to clearly record traffic:
Is there a way to find all blobs using an Azure side suffix without having to select the full blob list for the client?
+3
source to share
1 answer