How to find empty folders on Windows 10

How To Always Run PowerShell As Administrator In Windows 10

Windows 10 has a tool that lets you view disk space usage by folder. It’s in the Settings app and if you ever need to free up space on your hard drive, it’s a good place to start looking for what you need to clean up. Where large, useless files hog space, empty folders tend to create problems when you’re trying to find a file. Here’s how you can find empty folders on Windows 10.

Find empty folders

It’s pretty easy to find empty folders on Windows 10. You can run a simply command in PowerShell and it will list all the folders for you. The command can be run on an entire drive, or on a specific folder.

Open PowerShell and run the command below;

$SomePath="C:UsersfatiwDesktop"

Get-ChildItem -Path $SomePath -Recurse -Directory | ForEach-Object -Process {
if ($false -eq $_.GetFileSystemInfos())
{
$_.FullName
}
}

You have to edit the first line of the above command to suit your needs. In the first line, replace the path closed in the commas with the path to the folder you want to scan.

Examples:

To scan your entire C drive;

$SomePath="C:"

or

To scan the Steam library saved to the D drive;

$SomePath="D:SteamLibrary"

or

To scan a user folder;

$SomePath="C:UsersYourUserName"

The command will return a list of all empty folders in the specified location. The list will include the path to the folder. It will not delete or move anything. If you want to get rid of one of the folders, you can do so via PowerShell but it’s easier to delete them from File Explorer.

If you run this command on an entire drive, it might take longer to complete especially if you run it on your Windows drive however, it still scans fast and it is much better than using a clunky, or even a well-made tool to find empty folders on Windows 10. If you do use a tool, use one to delete the folders but as far as running a reliable scan goes, you can use PowerShell without any problems.

It’s worth pointing out that you do not need admin rights to run this command however, if you’re running it on your Windows drive, you should run it with admin rights or it will not be able to scan certain folders which are protected by the system. It’s possible that even with admin rights, the command cannot scan certain folders for empty folders. In this case, it’s best to leave those folders alone. They may be empty but your OS created them and may need to use them for something. If you delete the folders and later forget that you did, you might end up with problems and no way to figure out what went wrong.