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

Flow to delete document set shell when it contains zero child files/folders

Hello! 

I am currently looking for a way to build a recurring flow to look for and delete document set folders that contain zero items within. Any ideas? I have the recurrence set, but can't find an action that works.

1 REPLY 1
Community Support Team
Community Support Team

Re: Flow to delete document set shell when it contains zero child files/folders

Hi @lmaddock308,

 

It seems that there are some unclear places in your needs, I understand that you want to delete all empty folders in the SP Library.

But it seems that you just want to delete the folder that does not contain the item. If the folder contains an empty folder, it seems that you do not want to delete it.

A bit confused, could you provide more explanation?

Before that, I have a way to delete all folders in a SharePoint library without files. You can refer to it:

  Use Get items to get all the items in the Library, and then filter the items that are Folder by Filter array.

23PNG.PNG

    Then use the List folder to check if the body of this item is empty. If it is empty, the Folder does not contain any files. 

    Use the Delete item to delete this folder.

   Note: The red fonts in the figure are expressions that need to be filled in the Expression, not directly in the field.

        Please create a new Library for testing to avoid accidental deletion.

24.PNG

Please take a try.

 

Best Regards,

Barry

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
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 Kudoed Authors (Last 30 Days)
Users online (5,428)