sodcalculator

10 Tech How-To

Find & Remove Empty Folders in Windows (All Versions)

Guide 10-52418 · Updated · Step by step

This guide shows you how to locate and delete empty folders anywhere on your Windows PC, using built-in tools and a simple PowerShell script. You’ll learn a safe method that only removes folders with no files or subfolders, saving you from manual hunting. No extra software is needed—everything works with Windows 10 and 11.

What You’ll Need

  • A Windows PC (Windows 10 or 11 recommended; works on Windows 7/8 too)
  • Administrator access (only if you want to clean system folders, otherwise normal user is fine)
  • Basic comfort with File Explorer and copying/pasting commands

Step-by-Step

  1. Open File Explorer. Press Win + E to launch it.
  2. Navigate to the top-level folder you want to scan (e.g., C:\Users\YourName\Documents). This is the parent folder that contains the empty ones you want to remove.
  3. Decide on your approach:
    • If you have only a few folders, you can manually check each one: click a folder, press Ctrl + A to select all contents—if nothing is selected, the folder is empty, and you can delete it by pressing Delete.
    • For a large tree, use the PowerShell method below—it’s faster and catches nested empty folders.
  4. Open PowerShell in the folder. In File Explorer, click the address bar, type powershell, and press Enter. This opens a PowerShell window already set to that folder.
  5. Run a safe dry-run first (recommended). Type the following command and press Enter to list all empty folders without deleting anything:
    Get-ChildItem -Recurse -Directory | Where-Object { $_.GetFiles().Count -eq 0 -and $_.GetDirectories().Count -eq 0 } | Select-Object FullName

    This shows every folder that contains no files and no subfolders. Review the list to make sure it looks correct.

  6. If the list looks good, run the deletion command. Type this and press Enter:
    Get-ChildItem -Recurse -Directory | Where-Object { $_.GetFiles().Count -eq 0 -and $_.GetDirectories().Count -eq 0 } | Remove-Item

    This removes all empty folders in the current folder and its subfolders. Note: it only removes the deepest empty folders; if a folder becomes empty after its children are removed, it won’t be cleaned in this pass.

  7. Repeat the process to catch newly emptied parents. Run the dry-run command again. If it still lists folders, run the deletion again. Repeat until no empty folders appear. This ensures you remove nested empty folder chains.
  8. Verify the result. Navigate back to the parent folder in File Explorer and confirm that only the folders you wanted are gone.

Common Mistakes

  • Not running a dry-run first. You might delete folders that appear empty but contain hidden files (e.g., desktop.ini). The command above treats hidden files as files, so it’s safe, but it’s still wise to see the list first.
  • Forgetting that the command doesn’t repeat. If you have a chain like A -> B -> (empty), the first pass removes B, but A is now empty. You must run the command again to remove A.
  • Running from the wrong directory. If you open PowerShell from the Start menu instead of the folder, the command will scan your entire user profile or system drive, which could be slow or delete something you didn’t intend. Always open PowerShell from the target folder using the address bar trick.
  • Using Remove-Item -Recurse without the filter. That would delete everything, not just empty folders. Stick to the exact command.

Tips

  • Use the “Search” feature for a quick visual check. In File Explorer, type size:0 in the search box. This shows all zero-byte files, but not empty folders. Still, it can help you spot empty folders that contain nothing.
  • Create a restore point before mass deletion. If you’re cleaning a large drive, it’s a good safety net. Search for “Create a restore point” in the Start menu, and follow the prompts.
  • Use the Recycle Bin for safety. The PowerShell command above permanently deletes folders. If you want to send them to the Recycle Bin instead, use a third-party tool or move them manually. For most users, permanent deletion is fine, but be sure.
  • Clean up temporary folders too. Many empty folders come from uninstalled programs. After uninstalling apps, run this command on C:\Program Files (requires admin) and C:\Users\YourName\AppData\Local to remove leftover empty directories.

Troubleshooting

  • “Access Denied” errors. Some folders are protected by Windows (e.g., System Volume Information). Run PowerShell as Administrator: right-click the Start button, select “Windows Terminal (Admin)” or “PowerShell (Admin)”, then navigate to the folder using cd. If you still get errors, skip those folders—they’re usually system-required.
  • The command doesn’t find any empty folders, but you know there are some. This can happen if the folders contain hidden files. The command counts hidden files as files, so they aren’t “empty.” To include hidden files in the check, use this modified command:
    Get-ChildItem -Recurse -Directory | Where-Object { @(Get-ChildItem -Force $_.FullName).Count -eq 0 } | Remove-Item

    This checks for any item (including hidden) and deletes the folder if there are none.

  • PowerShell says the command is not recognized. Make sure you typed the command correctly and that you’re in PowerShell, not Command Prompt. If you’re in CMD, type powershell first and press Enter.
  • The process is too slow on a huge drive. The -Recurse flag scans every subfolder, which can take time. Narrow the scope by running the command on specific subfolders instead of the whole drive.

Frequently Asked Questions

Will this delete folders that contain hidden files?

No, the first command treats hidden files as files, so a folder with a hidden file is not considered empty. If you want to remove folders that only contain hidden files, use the modified command in Troubleshooting.

Can I undo the deletion?

No, the PowerShell command permanently deletes folders. They do not go to the Recycle Bin. If you need a safety net, create a restore point or move the folders manually.

Does this work on network drives or external drives?

Yes, as long as you have write permission to those drives. Navigate to the drive letter in File Explorer and run the command from there.

Why are there empty folders in the first place?

They often come from uninstalled software, interrupted file transfers, or apps that create folder structures but don’t clean up after themselves. They’re harmless but clutter your system.

Is there a way to find empty folders using File Explorer alone?

Not directly. File Explorer doesn’t have a built-in filter for empty folders. You can manually check each folder, but for large trees, PowerShell is the practical way.

What if I accidentally delete a folder I need?

If you didn’t create a restore point, you might be able to recover it from a backup or with file recovery software. But it’s best to run the dry-run command first and review the list carefully before deleting.

Related

General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.

More in this bed

The whole Tech How-To bed →