cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Delete folder in Sharepoint that have a different name every day

Hi, 

 

Once a day I download a .zip file that contains data of all the Trello-boards within a Team. 

This download will have a name such as "teamname_todaysdate_6randomdigits" (e.g. TrelloTeam_20190614_064234". 

 

I have created a flow that triggers when the .zip file is moved to a specific folder in Sharepoint, it then extracts it and moves it to the right location and deletes the original .zip file. 

 

My issue is that the next day when I run the flow I will have the existing folder e.g. "TrelloTeam_20190614_064234" in the Sharepoint-folder, additonally I will also have e.g. "TrelloTeam_20190615_123456" in the same folder. 

 

Therefore, I want to create a parallel branch in the Flow that deletes yesterdays folder (e.g. TrelloTeam_20190614_064234). 

 

Anyone know how I can achieve this? 

 

I'll provide a screenshot to illustrate what I am trying to achieve. 
The left side of the flow works just as I want it, but I have not been able to figure out the right side (how to delete the old/yesterday's folder). 

 

Thanks in advance! 

Flowtest.jpg

1 ACCEPTED SOLUTION

Accepted Solutions
Brad_Groux
Community Champion
Community Champion

Why not just utilize a condition that checks to see if the create and/or modified time of the folder is less than or equal to today, then delete it? Unfortunately, there isn't a Delete folder action with the SharePoint connector

If this is functionality you would like to see added to Flow or a Flow Template, please consider submitting it to the Flow Ideas page, where it can be voted on by other users, and tracked and commented on by the Flow team.

With that said, you do have some options. You can utilize the Move folder action to move the folders to a "to be deleted" or "to purge" folder or document Library, you could then have Flow clear out that entire library or folder.
Or, you could utilize SharePoint's REST API and an HTTP request to perform the delete action for the folder in question. See, Calling the SharePoint REST API in a Microsoft Flow by @RobWindsor

Please see the Working with folders and files with REST documentation for more information. Also, here are a few C# options that you could use with Azure Functions and Flow: 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

2 REPLIES 2
Brad_Groux
Community Champion
Community Champion

Why not just utilize a condition that checks to see if the create and/or modified time of the folder is less than or equal to today, then delete it? Unfortunately, there isn't a Delete folder action with the SharePoint connector

If this is functionality you would like to see added to Flow or a Flow Template, please consider submitting it to the Flow Ideas page, where it can be voted on by other users, and tracked and commented on by the Flow team.

With that said, you do have some options. You can utilize the Move folder action to move the folders to a "to be deleted" or "to purge" folder or document Library, you could then have Flow clear out that entire library or folder.
Or, you could utilize SharePoint's REST API and an HTTP request to perform the delete action for the folder in question. See, Calling the SharePoint REST API in a Microsoft Flow by @RobWindsor

Please see the Working with folders and files with REST documentation for more information. Also, here are a few C# options that you could use with Azure Functions and Flow: 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

Anonymous
Not applicable

Hi @Brad_Groux

 

Thanks for your reply. 

 

I have tried to delete the files by checking if modified or created time is less than today. However, I have not been able to succeed with deleting the files. 

 

The Flow runs successfully, but the folder with the files are not being deleted. 

 

Picture of the Flow is attached.

Do you have any idea what I'm doing wrong? 

 

Thanks! FlowExample.jpg

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (2,464)