cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mayankgoyal
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
ChristianAbata
Super User II
Super User II

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

@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.

@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

@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

@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

@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
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (3,294)