Skip to main content
Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
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?

  • sudosaurus Profile Picture
    1,597 Super User 2024 Season 1 on at
    Re: Step by Step (delete files older than)

    @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.

  • annetoal Profile Picture
    1,934 Super User 2025 Season 1 on at
    Re: Step by Step (delete files older than)

    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

  • richhowe Profile Picture
    31 on at
    Re: Step by Step (delete files older than)

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

  • Verified answer
    annetoal Profile Picture
    1,934 Super User 2025 Season 1 on at
    Re: Step by Step (delete files older than)

    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

     

     

     

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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 1

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 1