0

I am trying to get the size used for a Directory/ Sub-Directories in an azure file share storage account. I can get this information using the Azure Storage Explorer with Directory Stats button on the right hand top of the screen. However, I could not find an easy way to get this information via an API or Powershell command. I have looked at the following API: https://learn.microsoft.com/en-us/rest/api/storageservices/operations-on-directories

and also looked tried the C# Azure Storage SDK. No Luck yet.

Has anyone tried this ? Thanks!

1 Answers1

0

Unfortunately there's no API to do this. There's an API to get statistics at the share level (https://learn.microsoft.com/en-us/rest/api/storageservices/get-share-stats) but nothing for directory.

The way you will have to do this is list directories and files inside a directory recursively (https://learn.microsoft.com/en-us/rest/api/storageservices/list-directories-and-files). List operation will give you files and their size. You simply would need to add the size of each file to get the statistics for a directory.

Gaurav Mantri
  • 128,066
  • 12
  • 206
  • 241