Can we upload folder with files in Azure Blob storage like file share?

HemantSudehely-0557 261 Reputation points
2022-08-31T14:35:52.36+00:00

Hi Support Team,

I need a suggestion on Azure Blob storage. We are using Azure blob storage heavily for various files and now we have a need to categorize these files and stored in folder structure based on certain category. so need to stored same way that we use Azure File share.

Example - Azure Storage Account A - Container A - Folder1 - File1,File4,File9
Example - Azure Storage Account A - Container A - Folder2 - File11,File7,File10
Example - Azure Storage Account A - Container A - Folder3 - File21,File8,File2

We dont want to move to file share as this will require huge efforts, various changes and Azure File share is expensive as well.

Second question is how many blob containers i can create in single storage, is there any limitations?

Please suggest...

Azure Storage Explorer
Azure Storage Explorer
An Azure tool that is used to manage cloud storage resources on Windows, macOS, and Linux.
230 questions
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.
2,686 questions
Azure Blob Storage
Azure Blob Storage
An Azure service that stores unstructured data in the cloud as blobs.
2,427 questions
0 comments No comments
{count} votes

Accepted answer
  1. Michael Taylor 48,046 Reputation points
    2022-08-31T15:28:03.51+00:00

    Blob storage is just for storing a blob. What is a blob? It is a binary file that contains whatever you want. There is no such thing as "folders" in blob storage.

    However because people like to think of it as a virtual file system you can emulate "folders". When you name your blob include the "folder" name in the filename. For example if you want mydata.pdf to be under a company/product folder then upload the blob file with a name of company/product/mydata.pdf. The container itself it is just a collection of blobs and if you were to query for the blobs in the container you'd get this file back. But many people treat this as a virtual file system and the newer Azure Storage Explorer tool has switched to this view as well. In ASE if you look at a container then it'll render a folder-like structure based upon the names of the blobs stored in it.

    But remember that blob storage has no concept of folders so this is a virtual thing. You cannot do folder-like actions in a container. Some examples would include renaming a folder. To rename a "folder" you'd have to rename all the blobs that had the name in their path. This, of course, gets difficult if you're renaming a middle folder. You cannot delete a folder and all files in it. Again, you'd have to enumerate all the blobs and delete those that had a filename that matched.

    You also cannot efficiently enumerate a folder structure without having to enumerate all the blobs because the filenames contain the paths. If you're using Azure SDK for .NET (at least 12.13+) then they did add a method GetBlobsByHierarchy which hides some of these details from you but at the end of the day the more blobs you store in the container the slower this is going to be.

    Refer to the official docs for current Azure storage limitations. You can have any # of containers in a single storage account but storage accounts have a max size and the containers cannot exceed that total size.

    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. HemantSudehely-0557 261 Reputation points
    2022-08-31T17:41:37.43+00:00

    Is this not a physical folder? and what is the c# code we need to use to create this folder and retrieve files from this folder?
    236640-image.png

    236617-image.png