Showing results for 
Search instead for 
Did you mean: 
Level: Powered On

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


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.

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.


    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.


Please take a try.


Best Regards,


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


Power Automate Community User Group Member Badge

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


Incoming: New and improved badges!

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


Microsoft Learn

Learn how to build the business apps that you need.


Power Platform World Tour

Find out where you can attend!


Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

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