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

How delete many files from OneDrive older than 30 days

Hi,

 

I want to make a flow for delete many files from OneDrive older than 30 days.

I have make this but no files will deleted.

 

flow1.png

5 REPLIES 5
Highlighted
Super User
Super User

Re: How delete many files from OneDrive older than 30 days

Hi @frixel , I've noticed in my tests that the "List files in a folder" OneDrive action only gets the first 20 items. I don't know why it does that but it might go some way to explain why the flow isn't working as expected.

Rob
Los Gallardos
If I've answered your question or solved your problem, please mark this question as answered. This helps others who have the same question find a solution quickly via the forum search. If you liked my response, please consider giving it a thumbs up. Thanks.

frixel
Level: Powered On

Re: How delete many files from OneDrive older than 30 days

hi @RobElliott 

 

Where can i find that 'test" from you so i can dublicate that for testing by myself.

Now i try so many times to make a Flow for delete files in my OneDrive but it is always a mistake.

Community Support Team
Community Support Team

Re: How delete many files from OneDrive older than 30 days

Hi @frixel ,

 

Could you provide the details of the error message?

You could refer to the configuration below to create a Flow.

34.PNG

Expression reference:

formatDateTime(body('Get_file_metadata')?['LastModified'],'yyyy-MM-dd')
addDays(utcNow(),-30,'yyyy-MM-dd')

In addition, List files in folder action only returns 20 items. Currently there is such a restriction. If you want to increase the limit on the number of files returned, please consider voting for similar ideas:

List-files-in-folder-on-OneDrive-without-limit

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
frixel
Level: Powered On

Re: How delete many files from OneDrive older than 30 days

hi @v-bacao-msft 

 

Also this flow don`t delete any file in the folder.

There are files from 04-06-2019 till today in that folder but the flow gives in the output van compose 01-07-2019.

I see that come back every time I try to create a flow to clean up files.

 

flow1.png

Community Support Team
Community Support Team

Re: How delete many files from OneDrive older than 30 days

Hi @frixel ,

 

Note that only Last Modified Time can be obtained here.

If you are configuring Flow according to my method, the result is as expected, and compose is used to enter the last modified Time of the current file.

If the date is 2019-07-01, the result of the Condition judgment is false.

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
firstImage

Microsoft Flow Online Conference

Join us for a FULL day of FREE Microsoft Flow Sessions from some of the best minds in the industry!

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 Release Wave 2 Plan

Power Platform 2019 Release Wave 2 Plan

Features releasing from October 2019 through March 2020

thirdimage

Flow Community User Group Member Badge

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

thirdImage

New Flow Community Board!

Check out the new Microsoft Flow Community Blog Topic Suggestion board!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Flow Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 50 members 4,148 guests
Please welcome our newest community members: