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 / Delete files in OneDri...
Power Automate
Unanswered

Delete files in OneDrive older than 30 days

(0) ShareShare
ReportReport
Posted on by 1,004

i all,

 

I have been busy with this flow before and I thought it was solved.
See here this topic

 

I now have the Flow below, but it keeps throwing files away even though they are less than 30 days old.
The Flow also does not process more than 20 files while there are 100 that can be cleaned up.

 

Flow1.png

 

Categories:
I have the same question (0)
  • yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at

     

    In the List files in a folder, you can change the settings by enabling pagination and adding a value of your choice over there to get the number of files (Please see the screesnhot below)

     

    asds.png

    Also, please wrap the date in the ticks() function so that the comparision of the date is done properly. 

     

    Hope this Helps!

     

    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

    Hi @frixel 

  • frixel Profile Picture
    1,004 on at

    Hi @yashag2255 

     

    What do you mean with:

    please wrap the date in the ticks() function so that the comparision of the date is done properly. 

     

    And a error when i changed the pagination.

     

    Flow1.png

  • yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at

    @frixel 

    Can you share a screenshot of what error is coming? You were telling you had about 150 files so you can update the threshold to that number. By wrapping in ticks I meant that in the fomrat date and time function, use ticks(formatdatetime...) (please update the function acoordingly. you just have to add ticks() and ithin the brackets put the already available expression) E.g., ticks(formatDateTime(item()['LastModified'],'yyyy-MM-dd')) and do the same for the add days function. 

     

    Hope this Helps!

  • frixel Profile Picture
    1,004 on at

    Hi @yashag2255 

     

    Thanks, i changed the "ticks"☺

    But i have this error when i changed the pagination.

    Flow1.png

  • yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at

    @frixel 

     

    Can you try reverting the pagination change and check if you continue to get the error?

  • frixel Profile Picture
    1,004 on at

    Hi @yashag2255 

     

    I changed it to differents numbers but i get always the error.

     

    Flow1.png

  • yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at

    Can you disable the pagination and run and check if you get the same error?

  • frixel Profile Picture
    1,004 on at

    hi @yashag2255 

     

    Yes, then is there no error but only 20 files will be deleted and then the flow stops. 😞

     

    Flow1.png

  • yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at

    Hi @frixel 

     

    I just made a test at my end and unfortunately, right now the max number of files is capped at 20 (in the onedrive connector).

    https://powerusers.microsoft.com/t5/Flow-Ideas/List-files-in-folder-on-OneDrive-without-limit/idi-p/176396

    However, I used a work around as you can see in the flow below:cda.png

    All you have to do is create a variable and put an integer value (I just put 100 here) and then in the condition branch where you are deleting the files, use the actions and logic as in the above screenshot. 

     

    Hope this Helps!

     

    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

     

  • frixel Profile Picture
    1,004 on at

    Hi @yashag2255 

     

    I find it difficult how and where i must do it in  de existing Flow.

     

    Dou you think like this?

     

    Flow1.png

     

    Flow1.png

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!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 250 Super User 2026 Season 1

#2
Expiscornovus Profile Picture

Expiscornovus 222 Most Valuable Professional

#3
Haque Profile Picture

Haque 174

Last 30 days Overall leaderboard