ShareMaster V2 is in beta, a complete rebuild. See what is new and request access →
  1. Home
  2. Guides
  3. Remove Empty Folders in SharePoint Online

Remove Empty Folders in SharePoint Online (Step-by-Step)

Every file migration leaves a trace. Move or delete the files inside a SharePoint document library and the folder structure usually stays behind, untouched and empty, quietly cluttering navigation and search results for months or years. This guide covers three ways to find and remove those orphaned folders: the native SharePoint UI, PnP PowerShell, and ShareMaster's Space Master tool.

Why Empty Folders Accumulate

SharePoint does not automatically remove a folder when its last file is deleted or moved. Common causes of empty folder build-up include:

  • File migrations that moved content to a new site but left the source folder scaffold in place
  • Users moving files via Windows Explorer sync without deleting the source folder
  • Bulk delete operations that removed files but not their parent containers
  • Microsoft Teams channels being archived while the connected SharePoint library retains all folder structure
  • Automated processes that create a folder per job, then fail to clean up after completion

In a tenant with several years of history, the count can reach thousands of empty folders spread across dozens of sites. The folders take almost no storage, but they impose a real overhead on anyone navigating or searching for content.

When Should You Remove Empty Folders from SharePoint Online?

Empty folder cleanup is worth scheduling whenever one of these conditions applies:

  • You have completed a file migration from one site or tenant to another
  • A Teams team or SharePoint site has been decommissioned and its library cleared
  • Users are reporting confusing or redundant entries in library navigation
  • You are about to run a permissions audit and want to reduce noise in the report
  • You are preparing a site for migration with Clone Master and want to avoid copying empty containers to the destination
  • Your site's SharePoint search is returning zero-result folder hits for common queries

Folder cleanup is also a natural part of any quarterly SharePoint governance review. Adding it to a recurring checklist takes less than ten minutes per site once you have a process in place.

Method 1: Manual Cleanup in the SharePoint Browser UI

For a library with fewer than 50 folders, browsing manually is practical.

  1. Open the document library in SharePoint Online in your browser.
  2. Navigate into each folder to check for content, or edit a view to add the Item Child Count and Folder Child Count columns so you can sort folders by what they hold.
  3. Select the checkbox next to each empty folder.
  4. Choose Delete from the command bar. The folders go to the Recycling Bin.

This works for a one-off cleanup of a small library. It does not scale to sites with hundreds of folders or to tenant-wide cleanup involving multiple site collections.

Method 2: PnP PowerShell

PnP PowerShell lets you enumerate folders recursively and filter for those with no child items.

Prerequisites

  • PnP PowerShell module: Install-Module PnP.PowerShell
  • SharePoint admin permissions or site owner access on the target site
  • Your own Entra ID app registration to sign in with (PnP PowerShell no longer ships a shared one), with Sites.ReadWrite.All for tenant-wide scanning

Running the Cleanup

The core pattern is to connect to each site, call Get-PnPFolder to retrieve the folder tree, filter for folders where ItemCount equals zero and Folders.Count also equals zero, then pipe results to Remove-PnPFolder.

Tip: Always run the script in read-only audit mode first by commenting out the deletion step. Print the candidate list to the console and review it before enabling actual deletion. Cached item counts can lag by a few minutes after recent uploads, so a brief refresh wait before the audit pass reduces false positives.

For a tenant with more than five or six sites, wrapping the script in a loop over a CSV of site URLs exported from the SharePoint admin center is the standard approach. Each site needs a separate Connect-PnPOnline call and a reconnect after every few hundred API calls to avoid throttling.

The scripting overhead is real. Admins managing ten or more sites typically find that the time spent writing, testing, and running the script exceeds the time they would have spent on a tool-based approach.

Method 3: ShareMaster Space Master (No Scripting Required)

Space Master (Optimize Storage in the app) includes a dedicated Empty Folder Remover. The workflow takes about five minutes per library once you are familiar with it.

  1. 1 Open the Empty Folder Remover. In ShareMaster, go to Optimize Storage, choose Empty Folder Remover, and connect to the site with your Microsoft 365 account.
  2. 2 Pick the library or folder. Browse to the document library, or to a folder inside it, and click Next. Everything beneath that point is in scope, so pick a narrower folder if some placeholder folders elsewhere must stay.
  3. 3 Set an optional date fence. Exclude folders modified after leaves recently touched folders alone, which protects folders a team has just created for upcoming work.
  4. 4 Execute. There is no review list: clicking Execute starts the run. The tool works from the deepest folders up, so a folder that only held empty subfolders is removed too, and every folder with no files and no subfolders goes to the SharePoint Recycling Bin.
  5. 5 Check the result. Use Recycle Master if you need to search or restore from the bin after the cleanup.

Because every deletion routes through the Recycling Bin, the operation is fully reversible within the standard 93-day retention window.

Learn more about Space Master

Preventing Empty Folders from Returning

A one-time cleanup will not hold if the conditions that created the folders persist. A few governance steps make a difference:

  • Run empty folder cleanup as a post-migration checklist item. After every site or file migration, scan the source library before decommissioning the site. Catching empty folders at this stage keeps them from accumulating across subsequent quarters.
  • Include folder cleanup in your quarterly SharePoint health review. Sites that change frequently need more frequent scans. Sites in read-only archive mode rarely need attention after an initial clean.
  • Combine with a broader storage audit. Empty folders often coexist with other clutter: large files, excessive version history, and orphaned site collections. Running Space Master's full suite at the same time covers all of these in one session. See the guide on reducing SharePoint storage fast for a combined workflow.
  • Use Microsoft 365 Archive for inactive sites. Archive works on whole sites rather than individual libraries. If a site is being kept for compliance reasons but is no longer actively used, archiving it moves it out of active storage without permanent deletion, so its folder structure stops cluttering everyday navigation and search.

Frequently Asked Questions

Do empty folders in SharePoint Online consume storage quota?

Empty folders consume a negligible amount of quota (a few kilobytes of metadata each). The real cost is operational: they clutter navigation, inflate search results, and confuse users who cannot tell whether a folder was intentionally emptied or is still in use.

What happens to deleted folders in SharePoint Online?

Deleted folders move to the site's first-stage Recycling Bin, where they remain for up to 93 days before permanent deletion. If the first-stage bin is manually emptied, the folders move to the second-stage (site collection) Recycling Bin for the remainder of the 93-day window.

Can I find empty folders across all SharePoint sites at once?

The native SharePoint admin center does not provide a tenant-wide empty folder report. PnP PowerShell can scan across sites but requires per-site connections and scripting experience. ShareMaster Space Master's Empty Folder Remover clears a library or folder at a time without any scripting.

Will removing empty folders break any Power Automate flows?

Power Automate flows that trigger on activity in a specific folder path may behave unexpectedly if that folder is removed. Before proceeding with bulk deletion, check the Power Automate admin center for flows referencing the folder paths you intend to clear.

What to do next

Empty folders are tidiness rather than storage: they take almost no space. If you came here because a tenant is near its quota, the two things actually consuming it are version history and the recycle bin, both covered in reducing SharePoint storage fast.

Deciding whether to script the cleanup or buy a tool for it? PowerShell or buy gives you the calculation rather than a sales pitch.

Try ShareMaster free for 14 days