Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Using Flows
Unanswered

How to count days for delete files?

(0) ShareShare
ReportReport
Posted on by 901

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

  • v-bacao-msft Profile Picture
    on at
    Re: How to count days for delete files?

    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,

  • frixel Profile Picture
    901 on at
    Re: How to count days for delete files?

    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
    on at
    Re: How to count days for delete files?

    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
    901 on at
    Re: How to count days for delete files?

    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

  • frixel Profile Picture
    901 on at
    Re: How to count days for delete files?

    Hi @v-bacao-msft 

     

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

  • v-bacao-msft Profile Picture
    on at
    Re: How to count days for delete files?

    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
    901 on at
    Re: How to count days for delete files?

    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
    on at
    Re: How to count days for delete files?

    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,

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,660 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,999 Most Valuable Professional

Leaderboard

Featured topics

Restore a deleted flow