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

Delete files in OneDrive older than 60 day`s

(0) ShareShare
ReportReport
Posted on by 969

I try to make a flow for Delete files in OneDrive older than 60 day`s with this example.

 

But for this point:

  3-1. Action: Data Operations - Compose ( Inputs = "@div(sub(ticks(utcnow()), ticks(item()?['LastModified'])), 864000000000)" )

i can`t put it in the expression box, it gives a error.

 

Is there an other example to make a flow for Delete files in OneDrive older than xx day`s?

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

    Hi @frixel ,

     

    You can also try to filter the file using formatDateTime() function and addDays() function.

    Expression reference:

    formatDateTime(item()['LastModified'],'yyyy-MM-dd')
    addDays(utcNow(),-10,'yyyy-MM-dd')

    Image reference:

    35.PNG

    Please take a try.

     

    Best Regards,

  • ScottShearer Profile Picture
    25,270 Most Valuable Professional on at

    @v-bacao-msft :

    I believe that "false" in your condition must be entered in the expression window.  The screen shot looks like is was entered just as text.  Am I correct?

     

  • v-bacao-msft Profile Picture
    on at

    Hi @ScottShearer ,

     

    Thank you for your reminder, but I have tested it and found that using false is still work.

    Image reference:

    39.PNG40.PNG

    The current item is a file, so the result here is true.

     

    Best Regards,

  • frixel Profile Picture
    969 on at

    In both cases (false as text or expression) the flow does not work and the file`s from 3 days ago are not deleted.

     

    flow4.png

  • Verified answer
    v-bacao-msft Profile Picture
    on at

    Hi @frixel ,

     

    Please use Compose output Last modified and Is folder.

    45.PNG

    Please show the details of your Flow configuration.

     

    Best Regards,

  • frixel Profile Picture
    969 on at

    When i do this al the files wil be deleted Smiley Mad

     

    flow5.png

  • v-bacao-msft Profile Picture
    on at

    What happened, it should only delete the eligible files according to the conditions you set.

     

     

  • frixel Profile Picture
    969 on at

    Ahh,sorry. I forget to "update" the  addDays(utcNow) expression Man Happy

    Now it works fine.

  • frixel Profile Picture
    969 on at

    Can I ask one more question?

    If I want to receive 1 mail when files have been deleted, how do I set it?

    If I do it like the below, flow sent an email for each deleted file.(it would be even better if flow counts how many files have been deleted.)

     

    flow7.png

     

     

  • v-bacao-msft Profile Picture
    on at

    Hi @frixel ,

     

    You can initialize an array to store information about the filtered files.

    Use Length() function to calculate the number of files, or you could create an HTML table to display file information.

    Image reference:

    49.PNG50.PNG

     

    Please take a try.

     

    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

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

#2
Tomac Profile Picture

Tomac 296 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard