Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create empty folder in azure blob storage

How to create empty folder in azure blob storage just like empty folder in tool "Azure Explorer"

like image 757
Dragon Avatar asked Nov 03 '14 16:11

Dragon


2 Answers

Technically speaking, you can't have an empty folder in Azure Blob Storage as blob storage has a 2 level hierarchy - blob container and blob. You essentially create an illusion of a folder by prefixing the file name with the folder name you like e.g. assuming you want a style sheet (say site.css) in say css folder, you name the stylesheet file as css/site.css.

What some of the tools do is in order to create an empty folder, they create a zero byte blob and prefix it with the name of the folder and then don't show that zero byte blob. If you want, you can do that.

like image 66
Gaurav Mantri Avatar answered Nov 13 '22 11:11

Gaurav Mantri


Here's one way to do it with Linux.

az storage blob upload --container-name <container name> --name <folder name> -f /dev/null --account-name <storage account name>
  • the file name ends with a trailing slash (e.g. myfolder/)
  • the CLI expects a file, so just upload nothing (i.e. /dev/null/)
like image 27
Robert Chen Avatar answered Nov 13 '22 09:11

Robert Chen