DEV Community

thebernardlim
thebernardlim

Posted on • Edited on

1

Delete Files Older Than A Specific Date(s) in SharePoint Online

A very simple way to delete files (not folders) across multiple levels of folders, for files older than a specific date in SharePoint online is to use a Power Automate flow.

Here is what is required for the flow:

  1. Get files (properties only)

    • Include Nested Items: Yes (This is required if you need to delete files across multiple levels of subfolders)
    • Filter Query: Set to your respective date value. (Example below is where created file date is earlier or equals to 31st December 2022)
  2. Condition **in **Apply to each.

    • Check if IsFolder **is equals to **false. This is because Get files will also returns folder names.
  3. If yes, Delete file

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

Power Automate Flow

AWS GenAI LIVE image

Real challenges. Real solutions. Real talk.

From technical discussions to philosophical debates, AWS and AWS Partners examine the impact and evolution of gen AI.

Learn more

Top comments (0)

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay