Your input shapes our product. Suggest a feature now →
  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. Switch to the flat list view using the view menu (top right of the command bar).
  3. Filter or sort by item count, or simply navigate into each folder to check for content.
  4. Select the checkbox next to each empty folder.
  5. 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
  • Entra ID app registration 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 includes a dedicated Empty Folder Remover. The workflow takes about five minutes per site once you are familiar with it.

  1. 1 Sign in to ShareMaster with your Microsoft 365 admin account. Modern authentication is used throughout; ShareMaster does not store credentials.
  2. 2 Select the site collection in Space Master. You can target a single library or all libraries within a site.
  3. 3 Run the Empty Folder scan. Space Master traverses the folder tree and returns a sortable grid of folders that have no files and no sub-folders containing files. Each row shows the folder name, full path, and creation date.
  4. 4 Review and select. Check the folders you want to remove. Select all, filter by path pattern, or pick individually. Nothing is deleted until you confirm.
  5. 5 Delete. Click Delete Selected. Removed folders go to the SharePoint Recycling Bin. 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 intentionally emptied libraries. If a library is being kept for compliance reasons but is no longer actively used, Archive removes it from primary storage without permanent deletion, avoiding the empty folder problem entirely.

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 scans connected libraries and presents results in a single grid 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.

Try ShareMaster free for 14 days