question

HsinChen-0415 avatar image
0 Votes"
HsinChen-0415 asked HsinChen-0415 commented

How to delete empty folder on Azure Storage Explorer from powershell script

Hi,

I'm trying to delete the empty folders for managing shares ASE blobs.
From scouring the internet I've found anything that super straight forward.

Am looking for something along the line.

az login (to get the cred for current user)
azcopy remove "folder" from "blob URL"

Sites I came across that require a whole lot more set up that I wasn't able to complete.
https://stackoverflow.com/questions/49844535/delete-a-folder-in-azure-blob-storage
- script no longer available from shared link
- wasn't able to find the right module to install for the cmdlet "Get-AutomationPSCredential", and I think the "newer" version is now "Get-AzAutomationCredential" ?
- https://stackoverflow.com/questions/50534150/delete-all-files-from-azure-storage-subcontainer-using-powershell, wasn't able to use the cmdlet mentioned.

Looking for any guidance.



azure-storage-explorer
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Sam-Cogan avatar image
0 Votes"
Sam-Cogan answered

Folders don't really exist in blob storage, they are just a part of the path to a blob. If you delete all blobs under a folder, the folder will no longer exist.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

SumanthMarigowda-MSFT avatar image
0 Votes"
SumanthMarigowda-MSFT answered HsinChen-0415 commented

@HsinChen-0415 Adding more information to the above response!

Azure Blob storage does not have a concept of folders and everything inside the container is considered a blob including the folders. You can easily delete a folder including all its contents in Storage Explorer. Otherwise you will need to fetch a list of everything you wish to delete and run those through a loop to delete. For more programmatic solutions please check this thread.

Please let us know if you have any further queries. I’m happy to assist you further.


Please do not forget to 202308-screenshot-2021-12-10-121802.png and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.



· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi,
I've also came across the thread you shared.
Those appears to be in C# or some other language other than Powershell script.

Could we schedule a offline meeting to go over how one might create a powershell script to delete empty folder?
I understand the logic behind retrieving all the folders within a folder of a blob, but lack the info/experience on just setting a powershell script to obtain a blob, container, tenant-ID, etc.
Which I also don't have a clear understanding on the difference between them.

0 Votes 0 ·