Skip to main content

Notifications

Power Automate - Using Flows
Unanswered

Auto Delete Files after X amount od days

(0) ShareShare
ReportReport
Posted on by 14

Hey Guys,

 

I copied this flow (https://powerusers.microsoft.com/t5/Using-Flows/Automatically-delete-files-in-Document-Library-after-X-days/td-p/70009)  and had it working for a document library.

 

However I am trying to recreate this flow again on a different site and it runs sucessfully but is not deleting anything.

 

Ultimately I want to to delete any files older than 2 years in age (Date Created/Added/Uploaded to Site)

 

I am just trying to get it to delete after 1 day to verify it works before I change it to 730 days

 

I am using this:

@equals(formatDateTime(item()?['Created'], 'MM/dd/yyyy'), formatDateTime(addDays(utcNow(), -1), 'MM/dd/yyyy'))

 

Here is how my flow is layed out currently:

https://imgur.com/a/17gFUT3

 

https://imgur.com/a/46ZZaAU

 

Does it matter if the folder CGI which I am looking to delete the files in, is inside another folder?

 

company.sharepoint.com/shared documents/folder1/CGI

 

Any ideas why its not deleting the files in the CGI folder? They were all created/uploaded over a week ago.

 

Like I mentioned I have it working no issues on my other site but this one it doesn't seem to work.

 Thanks.

  • Re: Auto Delete Files after X amount od days

    Hello, @ScottShearer!

    Thank you for posting a reply to a topic on the Microsoft Flow Community! It appears that the users who you have been engaging in this thread with are now awaiting your reply! Please follow-up on this thread ASAP.

     

    Thank You!

    -Gabriel

    Microsoft Flow Community Manager

  • ufc205 Profile Picture
    ufc205 14 on at
    Re: Auto Delete Files after X amount od days

    Would it matter if its the top level site.

     

    The document library I am trying to run this on is on

     

    https://mycompany.sharepoint.com/Shared Documents/

     

    Which is just the main Document Library on the site.

     

    The site my flow works on with no issues is:

     

    https://mycompany.sharepoint.com/sites/Testsite

     

    And then a document library under here.

     

    The issue is the flow on the top level site shows that it runs sucessfully but its not actually deleting any files.

     

    On the Testsite it works perfectly.

  • ufc205 Profile Picture
    ufc205 14 on at
    Re: Auto Delete Files after X amount od days

    Does MS offer support on flows at all?

     

    I really need to get this figured out but even if I had to pay for support thats ok.

  • ufc205 Profile Picture
    ufc205 14 on at
    Re: Auto Delete Files after X amount od days

    Smiley Sad

  • ufc205 Profile Picture
    ufc205 14 on at
    Re: Auto Delete Files after X amount od days

    bump, any one else have any ideas?

     

    I am a site owner on both sites too.

     

    Will this method not work if the folder im trying to delete the files from is not at top level of document library???

  • ufc205 Profile Picture
    ufc205 14 on at
    Re: Auto Delete Files after X amount od days

    Not sure what you're asking you left out a word 🙂

     

    But does this help give any indication? This is from my run history for that flow:

     

    https://imgur.com/a/tWKBTiy

     

     

  • ScottShearer Profile Picture
    ScottShearer 25,150 on at
    Re: Auto Delete Files after X amount od days

    @ufc205:

     

    Sorry - I missed that part of your post.....

     

    When you look at the for each loop for a run of the Flow, does it give any indication of why the condition was not met?  Is it looping the correct number of times?

  • ufc205 Profile Picture
    ufc205 14 on at
    Re: Auto Delete Files after X amount od days

    Hey Scott, no I've seen that link but that is for files on an Azure FS it looks like but in any case like I mentioned I have the same setup working on another site.

     

    But for some reason this site its not working for and the flow runs sucessfully but doesnt delete anything.

  • ScottShearer Profile Picture
    ScottShearer 25,150 on at
    Re: Auto Delete Files after X amount od days

    @ufc205:

     

    Take a look at this solution as I believe it is very close to what you need.

     

    If this answers your question, please mark your post as Solved.

     

    Scott

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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,636

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,942

Leaderboard

Featured topics

Restore a deleted flow