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

Deleting Sub Folders

Hi,

 

I am trying to create a flow where I can delete a large number of subfolders within a folder. I want to keep the master folder but need to get rid of all its contents. This action will need to be completed once a year. Does anyone have any ideas or solutions?

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Deleting Sub Folders

My list is also a document library. Just type in the document library name as a custom value and it will find it with no problem.

Rob
Los Gallardos
If I've answered your question or solved your problem, please mark this question as answered. This helps others who have the same question find a solution quickly via the forum search. If you liked my response, please consider giving it a thumbs up. Thanks.

View solution in original post

6 REPLIES 6
FoDelement
Level 8

Re: Deleting Sub Folders

Where are you deleting the folders from?

One Drive, SharePoint, A File Share, Your local computer? 

This sounds more like a PowerShell thing than a Flow thing. Just my 2 Cents.

Brycekauffman
Level: Powered On

Re: Deleting Sub Folders

I am trying to delete them off SharePoint Online

 

FoDelement
Level 8

Re: Deleting Sub Folders

Okay, last question.

You said 


@Brycekauffman wrote:

 I want to keep the master folder but need to get rid of all its contents.

 


Does that mean, any files and folders in the root directory as well? 


Super User
Super User

Re: Deleting Sub Folders

HI @Brycekauffman, you can do this using the image below. So in this example I have a master folder called Accreditation and then a subfolder called New with a lot of subfolders in it. You can delete New and all the sub folders in it - but not the main Accreditation folder - by:

  1. Add an action for Get folder metadata by path. It uses the folder path of /Accreditation/New.
  2. Add a Delete item action using the list name Accreditation and the Id is the Get folder metadata ItemId from the dynamic content.

Rob
Los Gallardos
If I've answered your question or solved your problem, please mark this question as answered. This helps others who have the same question find a solution quickly via the forum search. If you liked my response, please consider giving it a thumbs up. Thanks.

0-DeleteFolders.png

Brycekauffman
Level: Powered On

Re: Deleting Sub Folders

It looks like my folders are set up in a document libreary and not a list. There for in the Delete Item flow it is not recongizing my folder structure in the "list name" section. What would be a good substitute? @RobElliott 

Super User
Super User

Re: Deleting Sub Folders

My list is also a document library. Just type in the document library name as a custom value and it will find it with no problem.

Rob
Los Gallardos
If I've answered your question or solved your problem, please mark this question as answered. This helps others who have the same question find a solution quickly via the forum search. If you liked my response, please consider giving it a thumbs up. Thanks.

View solution in original post

Helpful resources

Announcements
firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

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 Power Automate Community Video Gallery!

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (5,167)