Azure / azure-storage-java

Microsoft Azure Storage Library for Java
https://docs.microsoft.com/en-us/java/api/overview/azure/storage
MIT License
189 stars 163 forks source link

Java how to determine the size of cloud blob directory and container? #532

Open lalit-panda opened 4 years ago

lalit-panda commented 4 years ago

Which service(blob, file, queue, table) does this issue concern? Blob Storage

Which version of the SDK was used? com.microsoft.azure:azure-storage:8.0.0

Which platform are you using? (Java 8) Java

What problem was encountered? I have many Digital slides in azure blob storage so each digital slide directory has nearly .5M files so calculating individual files for calculating directory size is very time taking and we have already 12000 digital slide directory.so calculating individual blob for calculating file size is not practical for me. Is there any API I can use To calculate the file size by directory instead of indivisual blob.

How can we reproduce the problem in the simplest way? Have you found a mitigation/solution?

rickle-msft commented 4 years ago

Hi, @lalit-panda. Thank you for posting your question. There is not a way to get the total size of all the blobs in a container. The best option for you is to make a list containers call against the container or virtual directory and add up the Content-Length properties of all the blobs you find. And be sure to follow the continuation tokens.