Use PowerShell to find blank folders in Windows 10

PowerShell can help you easily find empty folders in . It only takes a few command lines.

If you like tidy spaces, frequently delete all junk and hate empty junk folders, then you can use the built-in Windows 10, PowerShell program to find empty folders very easily. And from then on it's up to you if you will these blank folders or not.

You can run a simple command in PowerShell and it will list all the empty folders it will find in specific locations that you have specified. In this command you can set the search to a whole disk or in a specific folder. Let's see how.

Step 1: Open PowerShell and run the following command.

$ SomePath = "C: \ Configuration \ dimitris"

Step 2: Then run the following command

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

You are most likely to have zero results because you simply need to first edit the first command of step 1, the above instructions, to suit your needs. Just replace the path that is within the quotes with the path of the folder you want to scan. It may be the entire C disk, so the command will be:

$ SomePath = "C: \"

or if you want to scan a user's folder, the command will be:

$ SomePath = "C: \ Users \ UserName"

The command will return a list of all empty folders to the specified location. The list will include the full 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 it through PowerShell, but it's easier to delete them from File Explorer.

If you run this command on a whole drive, you may need more time to complete and see the results, especially if you run it on the Windows drive, however, it still scans quickly and is much better than using a classic or even a well-constructed corresponding tool.

It's worth noting that you do not need administrator privileges to run this command, however, if you run it on the Windows drive, you have to run it with administrator rights, otherwise you will not be able to scan certain folders that are protected by the system.

It is possible that even with administrator privileges, the command may not be able to scan specific Windows folders. In this case, it is better to leave these folders in place and do not disturb them. They may be empty, but the created them and may need to use them for something. If you delete the folders and later forget you did it, you might end up with problems and not understand what's going on.

iGuRu.gr The Best Technology Site in Greecefgns

every publication, directly to your inbox

Join the 2.087 registrants.

Written by Dimitris

Dimitris hates on Mondays .....

Leave a reply

Your email address is not published. Required fields are mentioned with *

Your message will not be published if:
1. Contains insulting, defamatory, racist, offensive or inappropriate comments.
2. Causes harm to minors.
3. It interferes with the privacy and individual and social rights of other users.
4. Advertises products or services or websites.
5. Contains personal information (address, phone, etc.).