Share via

Delete Fileshare data based on data if fileshare capacity is more than 10TB

Sreenivasulu Madu 0 Reputation points
2025-09-16T09:49:31.86+00:00

How to Delete Fileshare data based on data if fileshare capacity is more than 10TB and script is stucking while running

Azure Automation
Azure Automation

An Azure service that is used to automate, configure, and install updates across hybrid environments.

0 comments No comments

1 answer

Sort by: Most helpful
  1. Amira Bedhiafi 42,941 Reputation points MVP Volunteer Moderator
    2025-09-16T12:32:06.4+00:00

    Hello Sreenivasulu !

    Thank you for posting on Microsoft Learn Q&A.

    I think the correct tag Azure Files and you want to auto purge old files whenever the used capacity of a share exceeds 10 TiB?

    What Azure supports (and doesn’t)

    You need to set an Azure Monitor metric alert on the share FileCapacity that triggers a runbook or a function and in that job you recheck usage, compute how many bytes to free, then breadth-first list the share.

    You can filter files older than x days and sort oldest first then write their paths to a text file and delete them in parallel with AzCopy until usage drops below 10 TB.

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.