WiseCleaner Think Tank

Encounter difficult computer problems?
All about maintenance and optimization of your Windows System.

Home > Think Tank > How to Remove Empty Folders on Windows 11

How to Remove Empty Folders on Windows 11

Aug 23, 2024

Windows operating systems, including the latest Windows 11, can accumulate empty folders over time. These folders may be the remnants of uninstalled software, file movement, or simply artifacts from your daily computer usage. While empty folders don’t typically take up a lot of space, they can clutter your file system and make it harder to find the directories you use. In this guide, we'll go through several methods for identifying and removing empty folders on your Windows 11 PC.

Method 1. Manually Deleting Empty Folders

This method is straightforward but can be time-consuming, especially if you have a lot of directories to sift through. Nevertheless, it’s the safest way to ensure you’re not accidentally deleting anything valuable.

1. Open File Explorer.

You can do this by clicking on the folder icon in the taskbar or pressing Win + E.

2. Navigate to the drive or folder where you suspect there are empty folders.

For example, C:\Users\Your Username\Documents.

3. Check each folder manually.

Right-click on a folder and select Properties to check its size. An empty folder will show 0 bytes.

4. Delete the empty folders.

Right-click on the empty folder and select Delete. Confirm the deletion if prompted.

Method 2. Using Command Prompt

The Command Prompt offers a quicker way to find and delete empty folders using specific commands.

1. Open Command Prompt.

Press Win + S, type cmd, and hit Run as administrator to enter.

2. Run the following command to navigate to the directory you want to check:

cd path\to\your\folder

Replace path\to\your\folder with the actual path.

Use a batch command to find and delete empty folders.

for /f "delims=" %i in ('dir /s /b /ad ^| sort /r') do rd "%i" 2>nul

(Note: In this article, we take the path: C:\Users\YNZQTECH-05\Documents\Test as a case to demonstrate.)

This command searches for all directories, sorts them in reverse order, and attempts to remove them.

Method 3. Using PowerShell

PowerShell provides powerful scripting capabilities that can also help you remove empty folders.

1. Open PowerShell.

Press Win + X and select Windows Terminal (Admin) or PowerShell (Admin).

2. Run a script to find and delete empty folders.

Enter the following script to locate and remove empty directories (Make sure to replace 'C:\path\to\your\folder' with your target directory):

Get-ChildItem -Path 'C:\path\to\your\folder' -Recurse -Directory |

Where-Object { $_.GetFileSystemInfos().Count -eq 0 } |

Remove-Item -Force

This PowerShell command will search through the specified directory and its subdirectories, identify empty folders, and delete them automatically. Make sure to double-check the directory path and review the folders before executing the command to avoid accidental deletion of important data.

Other tips:

Conclusion

Removing empty folders on Windows 11 can be done manually or by using command-line utilities. Each method has its pros and cons, but the combination of these methods ensures that your computer remains organized and free of unnecessary clutter. By regularly implementing these practices, you can keep your file system streamlined and efficient.

50