Table of Contents
Use PowerShell to list empty folders under a location you choose. An empty folder contains no files or subfolders, including hidden items. A folder with a zero-byte file or another empty folder inside it is not itself empty.
Start with a personal folder such as Documents. Empty folders usually occupy little space, so finding large files is more useful when your main goal is to recover storage.
List empty subfolders with PowerShell
Open Windows Terminal and choose a PowerShell tab. Administrator access is normally unnecessary for a folder you own.
The following example scans subfolders of your Windows Documents location. It only prints paths; it does not delete anything.
$root = [Environment]::GetFolderPath('MyDocuments')
Get-ChildItem -LiteralPath $root -Directory -Recurse -Force -ErrorAction Continue |
ForEach-Object {
$folder = $_
if (($folder.Attributes -band [IO.FileAttributes]::ReparsePoint) -eq 0) {
try {
$entry = Get-ChildItem -LiteralPath $folder.FullName -Force -ErrorAction Stop |
Select-Object -First 1
if ($null -eq $entry) {
$folder.FullName
}
}
catch {
Write-Warning "Could not inspect: $($folder.FullName)"
}
}
}To scan another location, replace the first line with a full path, for example:
$root = 'D:Projects'Then run the rest of the scan again. Keep quotes around paths containing spaces. The script checks subfolders, not whether the root folder itself is empty.
How the check avoids common mistakes
- Hidden contents:
-Forceincludes hidden items in the emptiness check. A folder is not reported merely because File Explorer hides its contents. - Permission errors: A folder that cannot be inspected produces a warning instead of being assumed empty.
- Links and special folders: Entries marked as reparse points are not reported as empty by this script.
- Nested folders: A parent containing an empty child folder still has an entry, so it is not listed as empty.
Microsoft's Get-ChildItem reference explains the directory, recursion, and hidden-item controls. Force does not bypass access permissions.
Check a result in File Explorer
Copy a reported path into File Explorer's address bar and open it. Review the location and any application that uses it before considering removal. A folder can be empty and still serve as an application's expected destination.
Do not rely on a search such as kind:folder size:empty as proof that a folder contains nothing. File searches and size filters do not always evaluate folder contents the way that query suggests. Likewise, a displayed size of zero can still describe a folder containing zero-byte files.
No registry modification or downloaded context-menu file is required for the PowerShell method.
If your goal is easier searching or more free space
For broader searches, TipsMake's Windows file-search tool comparison describes alternatives. Indexed results still need checking if an index excludes some files or locations.
For storage cleanup, use a size-based view to find large data rather than focusing on empty directories. TipsMake's disk-space analyzer overview covers tools for that different task.
Reader Comments 0
Sign in with email or Google to join the discussion.