RecoveryTools
SharePoint

How to Delete Empty Folders in SharePoint Online: 2 Ways

Jamie Kaler
· 5 minute read
Quick Answer

Delete empty folders SharePoint holds in 2 ways. Add the Item Child Count column to spot them in a library view. Delete small batches by hand from that view. Use a PnP PowerShell script for deep folder trees. Start the script in report only mode to audit the list. Skip the Forms folder and any folder that starts with an underscore. Deleted folders sit in the Recycle Bin for 93 days.

You want to delete empty folders SharePoint libraries collect over the years. Nobody knows which ones hold files and clicking through every branch takes hours.

Microsoft gives no empty folder cleaner. You get 2 workable ways, a check before every delete and the limits I watch first.

Why does SharePoint Fill up With Empty Folders?

People move files out of a folder and leave the shell behind. A site reorganization leaves the same trail.

Empty folders do not cost much space but they slow navigation and hide the folders that matter.

Which Cleanup Method Suits You?

Compare the two methods before you start.

WayBest forMain limit
Child count columnsA few folders in one librarySlow on deep trees
PnP PowerShell scriptMany nested foldersNeeds module and app setup

How do You Find Empty Folders in a SharePoint Library?

Who it suits. Owners who clean a library in the browser. Extra application. None needed.

A Microsoft Q&A answer shows how to find empty folders with two extra columns. You can delete the empty folders SharePoint lists with a count of zero once you confirm both counts.

  1. Start in the library. Browse to the folder tree you plan to clean.
  2. Edit the view. Choose Edit current view under View options.
  3. Add the counts. Tick Item Child Count and Folder Child Count and select OK.
  4. Sort the list. Select the Item Child Count heading and sort from low to high.
  5. Spot the zeros. A folder with zero in both columns holds nothing.
  6. Delete the folder. Select it and choose Delete from the command bar.

Heads Up. A folder that holds only an empty subfolder shows a folder count above zero. Delete the inner folder first. Large libraries can hide rows, as the guide on SharePoint lists that do not show all items explains.

How does a PnP Script Remove Empty Folders From SharePoint?

Who it suits. Admins comfortable with scripts. Extra application. PnP PowerShell module.

PnP script samples include a recursive script for this job. Admins who delete the empty folders SharePoint carries in bulk use it because it checks the deepest folders first.

  1. Install the module. Install PnP.PowerShell. Microsoft staff suggest PowerShell 7 and a fresh install.
  2. Get an app ID. The sample needs the client ID of your Microsoft Entra ID app.
  3. Sign in. The sample connects with interactive sign in.
  4. Start in report only mode. Set the ReportOnly parameter to true so the script lists empty folders and deletes nothing.
  5. Check the CSV. The script saves the folders it found to DeletedFolders.csv.
  6. Delete for real. Start the script again with ReportOnly off. It sends every empty folder to the Recycle Bin.

The sample treats a folder as empty when its size is zero and its file count is zero. It skips the Forms folder.

How do You Confirm a Folder is Safe to Delete?

  • Both counts. Item and folder counts must show zero.
  • System folders. Leave Forms and any folder that starts with an underscore alone.
  • Shared links. A link to a deleted folder stops working.
  • Flows and rules. Check any flow that saves files to that path.

Can You Restore a Deleted Empty Folder?

Anyone who deletes empty folders SharePoint stores has a safety net. Microsoft says a deleted folder lands in the site Recycle Bin for 93 days.

Restore it to its original place within that window. Once you clear it from that bin it moves to the second stage bin and only a site collection admin can bring it back.

What Limits Apply to Empty Folder Cleanup?

  • View size. Big libraries reach the 5,000 item list view threshold.
  • One library. A view covers one library and the script covers the library you name.
  • Module trouble. One Microsoft Q&A thread shows a user who hit command errors until the old PnP modules were removed.
  • Default delete. The PnP sample deletes unless you set the report only option.
  • App setup. The sample needs your own Entra ID app client ID.

Which Habits Keep Folders Tidy?

  • Use metadata. Columns and views replace deep folder trees.
  • Limit folder depth. Agree on two or three levels.
  • Clean on a schedule. A monthly check keeps the list short.
  • Combine with a copy check. Pair this cleanup with the guide on how to find duplicate files in SharePoint Online.

Which Mistakes Cost the Most During Cleanup?

  • Skipping report only mode. The sample deletes at once.
  • Reading one count. A folder can hold subfolders and show zero items.
  • Deleting system folders. Forms belongs to the library.
  • Forgetting links. Colleagues lose a shared path.

My Verdict on Cleaning up Empty Folders

Delete empty folders SharePoint holds in small batches first with the child count columns. Switch to the script when the tree grows deep.

Audit in report only mode first. The Recycle Bin gives you 93 days to undo a mistake.

Key Takeaways

  • Item Child Count and Folder Child Count reveal empty folders.
  • The PnP sample checks the deepest folders first.
  • Report only mode lists folders without deleting them.
  • Deleted folders stay in the Recycle Bin for 93 days.

Next Read

Frequently Asked Questions

Does SharePoint have a Button to Delete Empty Folders?

No, Microsoft shows no such button. Use the child count columns or a script.

Can I Find Empty Folders Without PowerShell?

Yes. Add Item Child Count and Folder Child Count to the view and look for zeros. A Microsoft Q&A answer describes this method.

Does the PnP Script Delete Folders Right Away?

Yes unless you set ReportOnly to true. The sample has no confirmation prompt. Audit first.

Can the Script Handle Folders Inside Folders?

Yes because it is recursive. It checks the deepest folders first so a parent folder is judged after its children.

Can I Restore a Folder I Deleted by Mistake?

Yes within 93 days. Open the site Recycle Bin and send the folder back to its place.

Should I Delete the Forms Folder?

No. Forms belongs to the library and the sample script skips it. Leave it and any underscore folder alone.

Do I Need My Own App ID for the Script?

Yes. The PnP sample asks for the client ID of your Microsoft Entra ID app. Replace the placeholder before you start.

Jamie Kaler
Jamie Kaler Marketing Head and Content Strategist, RecoveryTools

Jamie blends strategic marketing insight with technical writing, turning migration and recovery topics into guidance that works for technical and general readers alike.

Published 3 November 2026. The child count columns come from a Microsoft Q&A answer on how to clear all empty folders in SharePoint Online. Microsoft's page on how to delete items or empty the Recycle Bin covers the bin. The script steps follow the Microsoft PnP delete empty folders sample. Menus change. Confirm them on your own site.