sharepointsharepoint-2010sharepoint-onlinepower-automate

Auto Removal of files in Sharepoint Online


I have a SharePoint Online Site. In its Document I've multiple folders , sub folders and files of different types.

The thing is that I need to somehow delete all the files(only) under each and every folders or subfolders which are Created on or before year 2022.

It should not affect the present folder structures. So is there any possible way to do it ? I found something like, using Power Automate in Sharepoint will solve this problem, but I'm not an expert in that field.

Can anyone please help me out ?


Solution

  • This flow should work:

    1. Get files (properties only).

      • Set Include Nested Items to "Yes"
      • Set Filter Query field to Created le '2022-12-31'
    2. Condition in Apply to each.

      • Check if IsFolder is equals to false
    3. If yes, Delete file

      • File Identifier: Identifier (from the Get files (properties only) action)
    4. If no, do nothing

    Example flow below:

    enter image description here