0

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 ?

1 Answers1

1

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

thebernardlim
  • 755
  • 2
  • 10
  • 23
  • thanks for you response but what happen if I do not limit entries to folder? Will it still find all the files under Document and its every nested folders? – Suprateem Bose Feb 27 '23 at 10:12
  • @SuprateemBose Actually we do not need to limit entries if you do not want to. If your case is Documents, then leave it blank. I had just made some changes on my answer. You will need to set "Include Nested Items" to "Yes". Also since you need the subfolders to stay, you will need an extra Condition to only delete if it is a folder. Please accept it as an Answer if this helps. Thanks! – thebernardlim Feb 28 '23 at 02:01