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

Community site session details

Session Id :
Power Automate - Building Flows
Unanswered

Delete files in OneDrive older than 30 days

(0) ShareShare
ReportReport
Posted on by 969

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

 

I have the same question (0)
  • yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at
    Re: Delete files in OneDrive older than 30 days

     

    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
    969 on at
    Re: Delete files in OneDrive older than 30 days

    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
    Re: Delete files in OneDrive older than 30 days

    @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
    969 on at
    Re: Delete files in OneDrive older than 30 days

    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
    Re: Delete files in OneDrive older than 30 days

    @frixel 

     

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

  • frixel Profile Picture
    969 on at
    Re: Delete files in OneDrive older than 30 days

    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
    Re: Delete files in OneDrive older than 30 days

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

  • frixel Profile Picture
    969 on at
    Re: Delete files in OneDrive older than 30 days

    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
    Re: Delete files in OneDrive older than 30 days

    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
    969 on at
    Re: Delete files in OneDrive older than 30 days

    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

Coming soon: forum hierarchy changes

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

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Automate

#1
Tomac Profile Picture

Tomac 544 Moderator

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 482 Super User 2025 Season 2

#3
chiaraalina Profile Picture

chiaraalina 287

Last 30 days Overall leaderboard