DEV Community

thebernardlim
thebernardlim

Posted on • Updated on

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

Top comments (0)