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 / Automatic delete folde...
Power Automate
Unanswered

Automatic delete folders in OneDrive with Power Automate

(1) ShareShare
ReportReport
Posted on by 2
Hi,
 
I was able to move folders in OneDrive with Power Automate, and currently I am trying to automatically delete those folders older than a month,
 
I have tried to  
1) Set up recurrence,
1)I inserted a "Show files in the folder", selecting folder A.
2) For each -> Body/value
3) Conditional -> Last modified is less than addDays(utcNow(),-7)
4)True -> Delete Files -> id
 
I also read to use:
1. "Delete file" action does not work for folders; use "Delete folder" instead.
2. Ensure IsFolder is checked to delete only folders, not files. 
3. Compare LastModified with addDays(utcNow(), -7) correctly.

Below is fixed flow with correct expressions and conditions
1. Trigger: Recurrence (e.g., Daily)
2. Action: "List folder" (Folder A)
3. Apply to each: Body/value

    Condition 1: Check if item is a folder
        Expression: item()?['IsFolder']
        If true, proceed.
    Condition 2: Check if older than 7 days
        Expression: item()?['LastModified'] is less than
        Value: addDays(utcNow(), -7, 'yyyy-MM-ddTHH:mm:ssZ')
4. 
If True: "Delete folder" → Id

 
But I am afraid the last one is not suitable for OneDrive...
 
¿Could you help me?
 
Thanks
Categories:
I have the same question (0)
  • Suggested answer
    Michael E. Gernaey Profile Picture
    53,315 Super User 2025 Season 2 on at
     
    I am not sure if you got help with this but you have a couple of things
     
    1. Technically you could find it from the SharePoint connector and delete it (with some caveats)
     
    2. You can use Graph API
     
    To do it
     
    Apologies for the long delay, but let me know if you still need help.
     
    Cheers

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 523 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 406 Moderator

#3
abm abm Profile Picture

abm abm 245 Most Valuable Professional

Last 30 days Overall leaderboard