Showing results for 
Search instead for 
Did you mean: 
New Member

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
Community Support

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


August 2020 CYST Winners!

Check out the winners of the recent 'Can You Solve These?' community challenge!


Experience what's new for Power Automate

Join us for an in-depth look at the new Power Automate features and capabilities at the free Microsoft Business Applications Launch Event.


Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021


Power Automate Community User Group Member Badge

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

Top Solution Authors
Top Kudoed Authors
Users online (4,214)