Hello DEEPANSHU CHAUHAN,
Welcome to the Microsoft Q&A and thank you for posting your questions here.
Problem
I understand that you would like to delete files from the source storage after sharing them through data share.
Solution
You can achieve this by using other Azure services or manual deletion.
Solution 1: Create a time-triggered Azure Function or Logic App. For example, use the following Azure CLI script to delete files from your file share or modify to the source storage:
$myshare = "<<Share Name>>"
$accountName = "<<Storage Account Name>>"
$accountKey = "<<Storage Account Access Key1>>"
$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 --account-name $accountName --account-key $accountKey
}
}
Solution 2: Manual Deletion or cleanup. Periodically review the shared files and manually delete the ones you no longer need.
Accept Answer
I hope this is helpful! Do not hesitate to let me know if you have any other questions.
** Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful ** so that others in the community facing similar issues can easily find the solution.
Best Regards,
Sina Salam