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 / How to count days for ...
Power Automate
Unanswered

How to count days for delete files?

(0) ShareShare
ReportReport
Posted on by 1,089

Hi,

 

What goes wrong in my Flow to delete files older than 4 days?

As it stands now, some files (not all just 20 files) from 06-05-2019 (and also 07-05-2019) will be deleted.

I think there is something in the flow order of the flow error?

 

 

Flow2.pngFlow3.png

Categories:
I have the same question (0)
  • v-bacao-msft Profile Picture
    Microsoft Employee on at

    Hi @frixel ,

     

    It seems that this is the method I provided. I observed the configuration of your Flow, which is no problem with logica and it does delete the file with Last Modified Date as 06-05-2019.

    If you mean that it have not been able to delete the file with Last Modified Date as 07-05-2019, Please check the folder for eligible files.

    I am not sure what your problem is now, please provide more details.

     

    Best Regards,

  • frixel Profile Picture
    1,089 on at

    Hi @v-bacao-msft 

     

    I mean that files older than 4 days (addDays (utcNow (), - 04, 'yyyy-MM-dd')) must be deleted.


    But if the flow is running then it has cleaned up files from more than 4 days old.

     

    Yesterday it was 15-05-2019 and the files of 11-05-2016 (-4 days) should be deleted but he cleans up files from 06-05-2019 and 07-05-2019.

  • v-bacao-msft Profile Picture
    Microsoft Employee on at

    Hi @frixel ,

     

    Thank you for your reply, I understand what you mean now, you just want to delete the file for that day.

     

    Please replace is less than with is equal to in Condition.

     

    Best Regards,

  • frixel Profile Picture
    1,089 on at

    Hi @v-bacao-msft 

     

    No it must be deleted all files older then 4 days ahead.

  • frixel Profile Picture
    1,089 on at

    Hi @v-bacao-msft 

     

    I test it again, and yes it deletes well files older then 4 day`s, so that is oke.

    But......

    If there are 60 files in a folder to clean up (older than 4 days), it cleans up 12 files and leaves the rest.
    If I run the flow again, it clears up 4 files.
    So it is a different number every time instead of cleaning all files

  • v-bacao-msft Profile Picture
    Microsoft Employee on at

    Hi @frixel ,

     

    The parameter used here to determine is Last Modified Time. This value will change all the time, as long as the file has any changes.

    It is different from Create time and will not change once it is generated. This is a noteworthy place.

    The logic of the Flow configuration is no problem.

     

    Best Regards,

  • frixel Profile Picture
    1,089 on at

    Hi @v-bacao-msft 

     

    So I cannot adjust the flow to use the created date to clean up?

    If that is indeed not possible, how is it possible with Flow to clean up files older than 4 days?

  • v-bacao-msft Profile Picture
    Microsoft Employee on at

    Hi @frixel ,

     

    Unfortunately, the file information currently obtained from OneDrive or OneDrive for Business does not include Created Time.

    35.PNG

    If you want to use a similar feature, please consider storing the file in SharePoint Library.

     

    Best Regards,

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 238 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 225

#3
Haque Profile Picture

Haque 181

Last 30 days Overall leaderboard