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

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

3 REPLIES 3
v-zhos-msft
Level 10

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

lewisdhbrooks
Level: Powered On

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

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

Hi,

 

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

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Watch the event on demand for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

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!

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: 172 members 3,731 guests
Recent signins:
Please welcome our newest community members: