Share via

How can I add a file to azure storage without a file

Dariel Villaplana 0 Reputation points
2026-03-03T05:33:05.48+00:00

Hi! I just want to ask a question: how can I add to Azure storage/Blob storage a an empty folder, is it possible?

Azure Blob Storage
Azure Blob Storage

An Azure service that stores unstructured data in the cloud as blobs.

{count} votes

1 answer

Sort by: Most helpful
  1. Thanmayi Godithi 7,110 Reputation points Microsoft External Staff Moderator
    2026-03-03T07:22:32.1966667+00:00

    Hey @Dariel Villaplana,

    No, Azure Blob Storage does not support true empty folders/directories in the same way a traditional file system (like your local drive or SharePoint) does.

    Blob Storage uses a flat namespace, everything is stored as blobs (objects) inside containers, and what appears as "folders" are just virtual directories created by including forward slashes (/) in the blob names (e.g., myfolder/myfile.txt creates the appearance of a folder called myfolder).

    Because of this design:

    • Folders only appear when at least one blob exists with that prefix.
    • Truly empty folders (with zero blobs under that prefix) do not persist and cannot be created natively.

    Common Workarounds for "Empty" Folders

    1. Upload a zero-byte (empty) placeholder blob (most common method) :

    Create a blob named exactly like the folder path with a trailing slash, or a hidden marker file (e.g., myfolder/ or myfolder/.keep or myfolder/empty.txt with 0 bytes).

    Using Azure CLI (simple and effective):

    
       az storage blob upload \
    
         --account-name <your-storage-account> \
    
         --container-name <your-container> \
    
         --name "yourfolder/" \
    
         --file /dev/null   # on Linux/macOS
    
         # or on Windows PowerShell: --file $null
    
    
    1. Upload a small marker file (e.g., keep.txt, .placeholder, or empty.txt) :

    This is what many people do when scripting or migrating content. The file can be 0 bytes or contain a note like "Placeholder - do not delete".

    1. If you need real empty folders that persist

    Enable Hierarchical Namespace on your storage account (this upgrades it to Azure Data Lake Storage Gen2).

    Note: This is a one-way change , once enabled, it cannot be disabled. It also changes some pricing/behavior slightly, but it's ideal if you need filesystem-like semantics (e.g., rename folders, ACLs per directory, SFTP support).

    Check: [Azure Data Lake Storage Gen2 introduction]

    Regarding SharePoint Folder Uploads

    When uploading/syncing folders from SharePoint (which supports real empty folders) to Blob Storage, empty folders often disappear because no blob exists under that prefix. This is why you end up manually creating placeholders or editing paths — it's the expected behavior in standard Blob Storage (HNS disabled).

    If the information above wasn't helpful, please share the additional details requested via private message.

    If the answer is helpful, please "Accept the answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    0 comments No comments

Your answer

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