I have a following folder structure in the azure blob storage:
-MainFolder
-subFolder1
-foo1.json
-foo2.json
-subFolder2
-foo1.json
-foo3.json
-subFolder3
-foo1.json
-foo4.json
Is there a way to only read/ list out the foo1.json from each of these folders? Here is the code sample of what I am using:
BlobContainerClient containerClient = getBlobClient();
ListBlobsOptions options =
new ListBlobsOptions()
.setPrefix(blobStoragePath)
.setDetails(new BlobListDetails().setRetrieveMetadata(true)
.setRetrieveDeletedBlobs(true));
PagedIterable<BlobItem> listVersion = containerClient.listBlobsByHierarchy("/", options,
Duration.ofSeconds(30l));
The code loops through listVersion to get the BlobClient(for foo1.json) for each prefix. Unfortunately, in this case the BlobItem in listVersion doesn't contain properties which would've contained the lastModified dateTime.
I am planning to compare the lastModifiedDateTime for these blobs(foo1.json) with the lastModified date of previously saved version of this blob in the hashMap and update the hashMap with the latest changes if the lastModifiedDateTime doesn't match each time a new request is made.
Trying to make as minimal call to the blobService as possible.
If I use this method:
PagedIterable<BlobItem> listVersionBlobClients = containerClient.listBlobs(options, null);
Will list out all the blobItems(all of the files foo1, foo2....) which will delay the process (as I'll have to check if the file is foo1 or not for each call)
Any help/suggestion is much appreciated.