web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Step by Step (delete f...
Power Automate
Answered

Step by Step (delete files older than)

(0) ShareShare
ReportReport
Posted on by 31

Just new to power automate (flows), could anyone take me through step by step how i create a flow, that will go into a folder and subfolders and delete all files in each that are older than 14 days please?

Categories:
I have the same question (0)
  • Verified answer
    annetoal Profile Picture
    1,934 Moderator on at

    annetoal_0-1686678458391.pngannetoal_1-1686678561674.png

    annetoal_2-1686678587374.png

    From:

     

    outputs('Get_files_(properties_only)')?['body/value']

     

    Filter:

     

    item()?['{IsFolder}']

     

    is equal to false.

    annetoal_3-1686678722363.png

    Apply to each:

     

    body('Filter_array')

     

    Condition:

     

    items('Apply_to_each')?['Created']

     

    is less than or equal to

     

    subtractFromTime(utcNow(), 14, 'Day')

     

     

    Delete step:

    annetoal_4-1686679705635.png

    File identifier:

     

    items('Apply_to_each')?['{Identifier}']

     

     

    This ought to get you started. If it helped, please mark it as a Solution.

    Anne

     

     

     

  • richhowe Profile Picture
    31 on at

    Works perfectly. Thank you, one other quick thing on it, how do i set it to auto run every day?

  • annetoal Profile Picture
    1,934 Moderator on at

    Happy to help. Please mark it as a Solution.

    To make it run on a schedule, substitute a Recurrence trigger for the Manual trigger.

     

    Anne

  • sudosaurus Profile Picture
    1,599 Super User 2024 Season 1 on at

    @annetoal how would you apply the same logic to delete folders? As the above will only delete files in folders but not the folders themselves.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 594

#2
Valantis Profile Picture

Valantis 328

#3
David_MA Profile Picture

David_MA 281 Super User 2026 Season 1

Last 30 days Overall leaderboard