Forum Discussion
Arslan11
Mar 17, 2022Brass Contributor
Azure File sync: Script to delete the files, which has been modified for certain days
I would like to have a script, where we can delete the files from the azure file share, if it is has not been modified for certain days. I know we can use logic app , but it deletes the ...
sanketghorpade
Apr 06, 2022Copper Contributor
Hi Arslan11,
Azure Lifecycle Management for storage is generally used for this purpose but I see you are talking about the File Shares and so far there is no support for lifecycle management from Azure for File Shares.
I do not see a reason why you cannot use Logic App for the same purpose. You can use the logic app to check for the last modified date and use the date function in the condition action to add the logic which will help you to find if this is something "expired" and has to be deleted.
We are doing something similar using PowerShell script to find the last modified date of each blob file (as in our case Life Cycle Management didn't work for blob storage as we had different retention period for each file). If you can share the script where you are facing issue then I can help you further with it.
Thanks,
Sanket
Azure Lifecycle Management for storage is generally used for this purpose but I see you are talking about the File Shares and so far there is no support for lifecycle management from Azure for File Shares.
I do not see a reason why you cannot use Logic App for the same purpose. You can use the logic app to check for the last modified date and use the date function in the condition action to add the logic which will help you to find if this is something "expired" and has to be deleted.
We are doing something similar using PowerShell script to find the last modified date of each blob file (as in our case Life Cycle Management didn't work for blob storage as we had different retention period for each file). If you can share the script where you are facing issue then I can help you further with it.
Thanks,
Sanket
Arslan11
Apr 06, 2022Brass Contributor
Thanks for recommending to use logic apps, and go with last modified date. I am afraid haven't got a script.
As you have got a script, are you able to share with me. And I can have a view of it.
As you have got a script, are you able to share with me. And I can have a view of it.