Find and delete empty folders on Windows with PowerShell - Knowledge sharing blog

Note: Please read the article carefully before proceeding! If in the process of using you encounter any errors, such as broken download links, slow loading blog, or not being able to access a certain page on the blog ... then please inform me through the Contact page. Thanks!

After a long time using the computer (here I want to talk about is the Windows 10 operating system), after the installation of additional software, as well as uninstalling the software ... usually it will leave messages. empty items (these are folders containing temporary files or folders left over after you perform a software uninstall).

Although these empty folders usually do not affect too much to use the computer, but leaving too many empty useless folders will somewhat slow down the data access from the hard drive, so I encourage you to delete them.

Of course you can find and delete them manually, but the reason is that these empty folders are often scattered everywhere on the hard drive so deleting manually is very difficult and can say is Not very feasible.

Read more:

There are also some software support for this job, but if you do not want to use the software, there is a way for you

In this article I will guide you How to delete empty folders on Windows 10 automatically without using any software.

remove-folders-on-windows-bang-powershell (6)

How to find and delete empty folders on Windows 10 with PowerShell

In this article, we will use the PowerShell tool - a tool created by Microsoft with the purpose of replacing the traditional Command Prompt.

If the Command Prompt uses a fairly simple programming language, Powershell with the addition of Windows Scripting Host, VBScript, ... will give you more rights to deeply intervene in the Windows system.

However, it is only suitable for IT administrators and professional users, because for most basic users, the PowerShell command line is quite confusing and confusing, especially it also distinguishes both uppercase and lowercase letters in the command as well.


+ Step 1: First you open Windows PowerShell as Administrator by right-clicking on the Start button => and selecting Windows PowerShell (Admin).

Or You can press the key combination Windows key + X => then select Windows PowerShell (Admin) in the menu that appears.

remove-folders-on-windows-bang-powershell (1)

//*

If the menu opens without PowerShell but instead Command Prompt it's because you turned it off in settings.

To show it again, right-click on the Taskbar => and select Taskbar Settings, in the settings window of Taskbar this => you drag down and switch OFF => to ON at line:

Replace Command Prompt with Windows PowerShell in the menu when i right-click the start button or press Windows Key + X.

Tips: How to upgrade PowerShell to version 7.0 on Windows 10

remove-folders-on-windows-bang-powershell (2)

Alternatively, if you do not want to change the settings, you can enter the command powershell in the search box of Windows 10 (to open the search box you use the combination Windows + S)

=> Then right click on the application Windows PowerShell in search results => And select Run as Administrator you can also run PowerShell as Administrator on Windows 10.

Remember, any application you can find and use through Windows Search.

remove-folders-on-windows-bang-powershell (3)

// * out of reading more * //

+ Step 2: Now copy and paste the commands below to Windows Powershell => and Enter to start searching for empty directories.

Remember instead C: in turn $SomePath= into the path of the drive, or the folder you want to check if it has an empty folder.

The following command:

$ SomePath = ”C:

Get-ChildItem -Path $ SomePath -Recurse -Directory | ForEach-Object -Process {

if ($ false -eq $ _. GetFileSystemInfos ())


$ _. FullName



remove-folders-on-windows-bang-powershell (4)

Immediately, a list of series of directories in the directory you specified in the variable $SomePath will appear.

+ Step 3: Your job now is to access these links with Windows Explorer (Windows + E) and delete it.

remove-folders-on-windows-bang-powershell (5)

Similarly, if I want to check the directory Games in drive D: then I will fix the above code to: $ SomePath = ”D: Games ".... => okay Enter is to be.

With this tip, you don't necessarily need to use Windows PowerShell with Admin privileges, but if run normally, there will be a few system folders that PowerShell does not have access to to be able to detect empty folders.

Besides, there are folders that even though you have run PowerShell as Administrator, it cannot be detected. Usually these are folders created by the Windows system to ensure operation, so if you find it, you should not delete it.

In addition, you can refer to the following great article to make sure your computer is always clean: How to delete junk files on your computer, clean up your computer most effectively


So I have just detailed instructions for you how find and Delete empty folders on Windows 10 without installing any 3rd party software.

Hopefully this article will be helpful for you. In addition to this, if you know any other way, do not forget to share it with the brothers below the comment section below so everyone can know. Good luck !

CTV: Nguyen Thanh Tung -

Note: Was this article helpful to you? Do not forget to rate the article, like and share it with your friends and relatives!


seo marketing wordpress seo seo hosting seo and marketing word press seo wordpress and seo wordpress marketing hosting seo seo press pro market seo seo & marketing seo e marketing e marketing seo seo pro wordpress marketing & seo seo di wordpress wordpress seo host hosting and seo wordpress hosting seo wordpress seo wordpress wordpress for marketing seo press wordpress marketing for seo