cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
lewisdhbrooks
Frequent Visitor

OneDrive - Delete Files/Folders older than x days

Hi,

 

As the name implies, I'm looking for a flow that will delete files/folders that are older than 7 days.

 

Any help would be greatly appreciated

4 REPLIES 4
v-zhos-msft Solution Sage
Solution Sage

Re: OneDrive - Delete Files/Folders older than x days

Hi @lewisdhbrooks ,

According to your description, you want to delete files/folders that are older than 7 days in OneDrive via MS Flow.

I have made a test on my side, please take a try with the following workaround:

The expression of Compose is: addDays(body('Get_file_metadata')?['LastModified'],7,'yyyy-MM-dd'), add 7 days on the last modified date.

The expression of Condition is: greaterOrEquals(outputs('Compose'),utcNow('yyyy-MM-dd')), judge whether the files are older than 7 days.

we.png

2.png

Best Regards,

Zhongys

Highlighted
lewisdhbrooks
Frequent Visitor

Re: OneDrive - Delete Files/Folders older than x days

@v-zhos-msft 

I get this error due to being a folder

{
"status": 400,
"message": "Resource : ID is a directory. This API works only on files",
"source": "api.connectorp.svc.ms"
}
lewisdhbrooks
Frequent Visitor

Re: OneDrive - Delete Files/Folders older than x days

Hi,

 

I still want to build this flow, any help please?

JHufford
New Member

Re: OneDrive - Delete Files/Folders older than x days

Did you ever get this working? I'm attempting to do the same thing

 

When I run the flow I get the error:

Unable to process template language expressions for action 'Condition' at line '1' and column '2225': 'The template language function 'greaterOrEquals' expects all of its parameters to be either integer or decimal numbers. Found invalid parameter types: 'Boolean'.'.

Helpful resources

Announcements
MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Automate Community!

firstImage

Now Live: Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

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 Solution Authors
Users online (6,894)