I need to have some archive cleanup code to remove old Azure logs after a certain retention period has occurred.
I am aware that I can do this:
CloudStorageAccount storageAccount = CloudStorageAccount.Parse("");
CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
CloudBlobContainer container = blobClient.GetContainerReference("ctr");
var blobList = container.ListBlobs();
foreach(var blob in blobList)
{
logger.Info($"Blob Name: {blob.Uri}");
}
However within my container the structure is
/
/year/month/day/hour/files
So right now there is
/2017/5/11/14/files
/2017/5/11/17/files
/2017/5/11/22/files
/2017/5/11/23/files
and
/2017/5/12/11/files
Where files is multiple backup files.
The for loop only has 1 item in it's collection as the 2017 folder is the root.
Is there a way to retrieve all blobs?
The end goal is to delete all blobs older than the retention period.