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

Notifications

Announcements

Community site session details

Community site session details

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

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard