@Zaeemul Haque To delete older files from each folder in Azure Blob Storage, you have a couple of options:
#1. Blob Lifecycle Management (Recommended):
Azure Storage provides a feature called Blob Lifecycle Management. With this, you can define policies to automatically delete blobs based on criteria such as their age (e.g., older than 30 days).
Go to your Azure Storage Account.Navigate to Blob Service > Lifecycle Management. Define a policy to delete blobs older than your desired threshold (e.g., 14 days). Azure Storage will handle the deletion for you.
#2. Azure Functions:
You can create an Azure Function that periodically checks each folder and deletes files older than a specified duration. Here’s a high-level approach:
Create a Timer Trigger function. Fetch the list of blobs from the corresponding Blob Container. Check the LastModified property of each blob. Delete the blobs that don’t meet your criteria (e.g., older than 14 days).
Remember to test any deletion process on a test folder first to avoid accidental data loss. Adjust the path and days as needed for each folder.