Reputation: 11
I am trying to see if there is a more efficient way to get the size of CloudBlobDirectory (including the CloudBlobs within it). I am seeing listBlobs() along with "blob.downloadAttributes()" for each blob take 10-15 minutes for ~10,000 blobs. This is what I am doing currently:
for (ListBlobItem blobItem : azAccount.getContainer().listBlobs(path)) {
if (blobItem instanceof CloudBlob) {
CloudBlob blob = (CloudBlob) blobItem;
blob.downloadAttributes();
totalSize += blob.getProperties().getLength();
}
}
Is there a faster way to do this?
Upvotes: 1
Views: 341
Reputation: 2457
You don't need to do the additional downloadAttributes. If you simply delete that line, I think you'll see it works. ListBlobs populates the content length property for the blobs it returns.
Upvotes: 2