Hello @Zain Ul Abideen,
Welcome to the MS Q&A platform.
A similar thread has been discussed here.
You can leverage the below script to delete the files for a specific time span.
I hope this helps. Please let me know if you have any further questions.
connect-azaccount
$accountName = '<accountname>';
$accountKey = '<accountkey>';
$myshare = '<file sharename >';
// Delete old files
$filelist = az storage file list -s $myshare --account-name $accountName --account-key $accountKey
$fileArray = $filelist | ConvertFrom-Json
foreach ($file in $fileArray | Where-Object {$_.properties.lastModified.DateTime -lt ((Get-Date).AddDays(-90))})
{
$removefile = $file.name
if ($removefile -ne $null)
{
Write-Host "Removing file $removefile"
az storage file delete -s $myshare -p $removefile
}
}