cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ufc205
Level: Powered On

Auto Delete Files after X amount od days

Hey Guys,

 

I copied this flow (https://powerusers.microsoft.com/t5/Using-Flows/Automatically-delete-files-in-Document-Library-after... 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.

9 REPLIES 9
Super User
Super User

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

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott
ufc205
Level: Powered On

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.

Super User
Super User

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?

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott
ufc205
Level: Powered On

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

 

 

ufc205
Level: Powered On

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
Level: Powered On

Re: Auto Delete Files after X amount od days

Smiley Sad

ufc205
Level: Powered On

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
Level: Powered On

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.

Highlighted
Administrator
Administrator

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

-Gabriel
Microsoft Power Automate Community Manager
Are YOU a member of your local Power Automate User Group?
Fill out This Form to claim your Community User Group Member Badge!

Helpful resources

Announcements
firstImage

New Ranks and Rank Icons in April

Read the announcement for more information!

firstImage

Better Together Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Community Summit North America

The top training and networking event across the globe for Microsoft Business Applications

Top Kudoed Authors
Users online (9,423)