web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Delete folder in Share...
Power Automate
Answered

Delete folder in Sharepoint that have a different name every day

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

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

Categories:
  • Verified answer
    Brad_Groux Profile Picture
    4,556 on at

    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!

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    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

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
Mohsin Ali Profile Picture

Mohsin Ali 414

#2
11manish Profile Picture

11manish 335 Super User 2026 Season 2

#3
M Bilal Khan Profile Picture

M Bilal Khan 274

Last 30 days Overall leaderboard