Reputation: 1691
I would like the stats of specific folders in Azure Blob Storage. For example I would like to know how many files are present in a folder, whats the size of each file or whats the total size of a folder. Does blob storage provide similar data through an api endpoint?
Edit: I have a very large number of files on Azure Blob so I am looking for a solution where I do not have to iterate over all the files in order to calculate total size of the virtual folder.
Upvotes: 4
Views: 7642
Reputation: 136226
Does blob storage provide similar data through an api endpoint?
As such Azure Blob Storage does not provide an API to get storage statistics at the folder level but you can make use of List Blobs
REST API operation to get that information.
List Blobs operation will list the blobs insider a container but you can use prefix
parameter to get the list of blobs inside a virtual folder where prefix
will be the path of the virtual folder. For example, if you wish to list the blobs inside folder1
virtual folder, you would specify prefix
as folder1/
Each item in the list is a blob which will have a size
attribute which will give you the size of the blob. You will simply add the size of individual blobs to get the total size of the folder.
Upvotes: 1