skip to Main Content

I have Blob in that is placed inside Virtual Directory. For example :

Test/Simulation/Testing.txt

Is it possible to delete Testing.txt only via Azure CLI ?

I’ve tried to use az storage blob delete and az storage blob delete-batch commands but without success.

While trying to delete the blob with both commands from above the Virtual Directories Test/Simulation are also being deleted.

2

Answers


    • It is not possible to keep empty directories/folder in Azure Blob Storage if the Hierarchical namespace is disabled.
    • To keep the empty directories in Azure Blob Storage, you need to use Data Lake Gen2 Storage Account

    reference from Sumarigo

    Login or Signup to reply.
  1. While trying to delete the blob with both commands from above the Virtual Directories Test/Simulation are also being delete.

    In Azure Blob Storage, you can’t store empty folders because folders are represented as virtual directories. These directories are created by including a forward slash (/) in the blob name.

    If you need to keep empty directory, you need to enable hierarchical namespace to existing storage account.

    You can follow this MS-Document to upgrade the existing storage v2 to Azure data lake storage gen2 with some unsupported features.

    Portal:

    When the migration is complete, a message similar will appear.

    enter image description here

    Now, you can be able to keep the empty folder in the storage account and also you can use the same command to delete the files only.

    Portal:

    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search