I need to download a file from Azure Blob storage. But the file inside another folder. For example;
Blob Containers
---myBlobContainer
-----TestFolder1
-------TestFolder2
-----------aaa.jpeg
I want to download aaa.jpeg file. I can download it when the situation like below;
Blob Containers
---myBlobContainer
------aaa.jpeg
How can I navigate through the folders, I cant give a path to the file. Thanks
There's no folders when using Azure Storage Account. You have a container, and all the rest is part of the blob name.
e.g.
myBlobContainer/TestFolder1/TestFolder2/aaa.jpeg
myBlobContainer is the container name
/TestFolder1/TestFolder2/aaa.jpeg
is the blob name
An easy way to double check this, just loop over all the blobs inside a container, you can confirm the 'sublevels' are part of the blob name
BlobContainerClient blobContainerClient = new BlobContainerClient(connectionString, container);
blobContainerClient.CreateIfNotExists();
Console.WriteLine("Listing blobs...");
// List all blobs in the container
var blobs = blobContainerClient.GetBlobs();
foreach (BlobItem blobItem in blobs)
{
Console.WriteLine("\t" + blobItem.Name);
}