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.
01Command
$ Get-ChildItem 'C:\Data' -Recurse -Directory |
Where-Object { (Get-ChildItem $_.FullName -Force | Measure-Object).Count -eq 0 } |
Select-Object -ExpandProperty FullName02What 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
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- Get-ChildItemEvidence: Get-ChildItem -Directory lists folders; testing whether a folder contains any items (with -Force) identifies empty ones.
- Get-ChildItem - SS64Evidence: Documents -Force to include hidden items and -Directory to restrict results to folders.
Last verified: 2026-09-18 · Category: Files & Folders
06Related solutions
Diagnose NTFS file system errors and bad sectors on any volume — including the system drive while Windows is running — before committing to a repair.
Robocopy is Windows' built-in robust file copier: use /MIR to keep a destination folder as an exact one-way mirror of a source, resumable and restartable.
Search inside text files and logs with regex, returning file, line number and match.