Your input shapes our product. Suggest a feature now →
  1. Home
  2. Compare
  3. Empty Folder Removal: Methods Compared

3 Ways to Find and Remove Empty Folders in SharePoint Online

Method Finds nested empty folders Bulk delete Minimum access level Scripting required
Manual review (browser or synced folder) One level at a time No Contribute No
PnP PowerShell script Yes, recursive Yes Site owner or above Yes
ShareMaster Space Master Yes, recursive, tenant-wide Yes Contribute (per site) No

Three approaches exist for clearing empty folders out of a SharePoint Online document library. The table above is the short version. The rest of this page covers what each one actually involves.

What counts as an empty folder in SharePoint Online?

An empty folder is a folder object with zero files and zero subfolders containing files beneath it. A folder holding only other empty folders still counts as empty for cleanup purposes, since deleting the innermost folders first eventually collapses the whole branch. Folders with metadata columns set, unique permissions applied, or a retention label attached are technically still "empty" but often need extra care before removal.

Why empty folders build up in a document library

Empty folders rarely appear by accident one at a time. They tend to arrive in batches, from a small set of recurring causes:

  • Migration scaffolding. A migration tool recreates the full source folder tree before copying files in, and a handful of source folders that held nothing but temp files or thumbnails arrive with no content.
  • Workflow-provisioned folders. Power Automate flows or third-party workflow tools create a folder per record, order, or case, and some of those records are cancelled or never populated.
  • Reorganisation debris. A team moves files into a new structure but never goes back to delete the now-empty source folders.
  • Sync client quirks. Occasionally a sync conflict leaves a folder with content on one device and nothing on another, and the empty side survives after the conflict resolves.

Method 1: Manual review through the browser or synced folder

The most direct approach: open the library in the browser or in File Explorer through the OneDrive sync client, switch to a view that shows item counts per folder (or simply open each folder and look), and delete anything with nothing inside it.

This works, but it does not scale. A few practical limits show up quickly:

  • SharePoint's default document library view does not show an item count column without customisation.
  • There is no built-in filter for "folders with zero items," so every folder has to be opened and checked individually.
  • Nested empty folders require checking from the bottom of the tree upward, since a parent folder containing only empty subfolders will not look empty until the children are removed first.

Best for: a single library with a shallow folder structure and a handful of suspected empty folders, checked as a one-off task rather than a repeated maintenance job.

Method 2: A PnP PowerShell script

Detection

Get-PnPFolderItem combined with a recursive function can walk a library's full folder tree and report any folder where both the file count and subfolder count are zero. Because the check has to happen bottom-up, the script typically processes the deepest folders first, then re-evaluates parent folders after their children are handled.

Deletion

Once the script has a confirmed list of empty folder paths, Remove-PnPFolder (or Move-PnPFolderToRecycleBin for a recoverable version) removes them. A well-written script logs every folder path before deleting anything, so the run can be audited afterward.

Best for: admins with existing PnP PowerShell tooling who want empty-folder cleanup folded into a broader governance script, and who are comfortable validating recursive logic against a test library first.

Method 3: ShareMaster Space Master empty folder remover

ShareMaster's Space Master includes a dedicated empty folder detection and removal tool. It scans a site, library, or the entire tenant, walks the folder tree recursively (including nested empty branches), and presents a list of every folder that qualifies for removal before anything is deleted.

Because the scan runs from the desktop application rather than a script window, results are presented as a browsable, sortable list rather than a console log. You can exclude specific folders from the run, review the full path of each candidate, and send matches to the recycle bin rather than deleting permanently, which keeps the operation reversible if a folder turns out to be needed after all.

Space Master's empty folder scan runs alongside its other storage tools, so a single connected session can find empty folders, trim version history, and reduce oversized images without switching applications.

Best for: tenant-wide or multi-library cleanups, admins who prefer a reviewable list over a script log, and anyone who wants recycle-bin-safe deletion by default.

Decision matrix: which method fits your situation?

Scenario Recommended method
One library, shallow structure, a few suspected empty folders Manual review
Deep nested folder trees across a large library PnP PowerShell or Space Master
Tenant-wide cleanup across many sites Space Master
Existing PowerShell governance pipeline PnP PowerShell
Need a reviewable list before deleting anything Space Master
Post-migration scaffolding cleanup Space Master or PnP PowerShell

See how Space Master finds and removes empty folders

Frequently Asked Questions

Do empty folders take up storage in SharePoint Online?

An empty folder itself uses a negligible amount of storage, just its metadata entry. The real cost is indirect: a large number of empty folders inflates the item count in a library, which affects list view thresholds, search crawl time, and how long the OneDrive sync client takes to walk the folder tree on every device.

Why does SharePoint accumulate so many empty folders?

Most come from migrations that recreate a source folder structure before copying files, workflows that provision a folder per record and never clean up cancelled ones, and manual reorganisations where content is moved out but the original folder is never deleted.

Can I safely delete all empty folders in a library at once?

Usually, provided the folders carry no unique permissions, no metadata set at the folder level, and no automation watching for their existence. Review the candidate list before a bulk delete rather than assuming every empty folder is disposable.

For related storage cleanup steps, see the guide to reducing SharePoint storage fast, or compare recycle bin bulk clear options on the recycle bin bulk clear comparison page.

Try Space Master free for 14 days