cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Regular Visitor

Deleting folders inside a particular folder on Sharepoint Online

Hi, I have a folder on Sharepoint. Inside this folder, some folders are created daily with name as date and time format like - '2020-09-21-1000 AM'. These folders have some files. I want to create a flow that runs daily and delete all folders with name 15 days or before current date. So if today is 21 Sept, 2020, any folder with name '2020-09-06 *" or less should be deleted. Kindly advise how to do this.

6 REPLIES 6
Highlighted
Super User III
Super User III

hi @mayankgoyal  you can follow this topic to find how to dele folders

 

https://powerusers.microsoft.com/t5/Building-Flows/Delete-a-folder-in-SharePoint/m-p/659117



Did I answer your question? Please consider to Mark
my post as a solution! to guide others :winking_face:

Proud to be a Flownaut!


If you want you can follow me at www.christianabata.com Quieres contenido en español? Síguenos en Power Automate LA
Highlighted

@ChristianAbata - I checked the response, not able to understand one thing, where and how will I apply the date logic to only delete folder with name 15 days or before and skip the others.

Highlighted

@mayankgoyal  oh you need to do something like this

 

like.PNG



Did I answer your question? Please consider to Mark
my post as a solution! to guide others :winking_face:

Proud to be a Flownaut!


If you want you can follow me at www.christianabata.com Quieres contenido en español? Síguenos en Power Automate LA
Highlighted

@ChristianAbata - Thanks a lot for your response, I am bit new to power automate and learning it, is there a way we can implement something like below. In our case there is a parent folder, which has n number of folder i want to delete all folders with foldername beyond 15 days. Folder name is in date time format.

 

Get all folders in parent folder
For each folder in folders list
      If Date(folder.name) < now - 15
             Delete(folder.name)
      End If
Next

Highlighted

@mayankgoyal  yes my example did what you need

 

see Date(folder.name) is equals to my NAME condition

 

In my condition I have equals to, you need to change ot for less than

 

The expression gives you the number

 

and last you need to select the folder you are going to delete



Did I answer your question? Please consider to Mark
my post as a solution! to guide others :winking_face:

Proud to be a Flownaut!


If you want you can follow me at www.christianabata.com Quieres contenido en español? Síguenos en Power Automate LA
Highlighted

@ChristianAbata  - I tried this, the challenge I am facing is with step1, I provided parent folder path in Get folder metadata using path. It doesnt return list of sub folders in parent folder. I need the list to loop on it and check name of each sub folder and then decide to delete it.

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Top Solution Authors
Top Kudoed Authors
Users online (10,743)