Find Empty Folders on Windows with PowerShell

List every folder that contains nothing (hidden files included) using Get-ChildItem -Recurse -Directory and a count check.

WindowsdirectoriescleanupFilespowershellLow risk
Run the Get-ChildItem -Recurse -Directory pipeline with Where-Object { (Get-ChildItem $_.FullName -Force | Measure-Object).Count -eq 0 }.

01Command

Command
$ Get-ChildItem 'C:\Data' -Recurse -Directory |
  Where-Object { (Get-ChildItem $_.FullName -Force | Measure-Object).Count -eq 0 } |
  Select-Object -ExpandProperty FullName

02What it does

A folder counts as empty only when it has zero items including hidden ones — that's why the inner check uses -Force. Review the list first; append | Remove-Item to actually delete the folders, but run it top-down or repeat it, since removing a parent makes its empty children disappear too. This is a common final step after reorganizing music, photos or uninstalled programs.

03Risk

RiskLow risk
!Warning: Some apps keep empty folders on purpose as placeholders (profile data, sync targets); deleting them can cause errors — review before using Remove-Item.

04Undo

✓No undo needed — this command does not change persistent state.

05Sources

  • Get-ChildItem
    Microsoft Learn · vendor-doc · 2026-09-17
    Evidence: Get-ChildItem -Directory lists folders; testing whether a folder contains any items (with -Force) identifies empty ones.
  • Get-ChildItem - SS64
    SS64 · technical · 2026-09-17
    Evidence: Documents -Force to include hidden items and -Directory to restrict results to folders.

Last verified: 2026-09-18 · Category: Files & Folders

06Related solutions