Use PowerShell to find blank folders in Windows 10

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

If you like neat areas, frequently delete all the garbage and hate empty junk, then you can use PowerShell's built-in utility to easily find empty folders. And then it's up to you whether or not to delete these empty folders.

You can run a simple command in PowerShell and it will list all the empty folders it finds in specific locations you specify. In this command you can set the search to be performed on an entire drive 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 - | 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 likely that even with administrator privileges, the command can not scan specific Windows folders. In this case, it is best to leave these folders in place and not to hurt them. They may be empty, but their operating system has created them and may need to use them for something. If you delete the folders and later forget that you've done it, you may end up in trouble and not understand what's going on.

iGuRu.gr The Best Technology Site in Greecefgns

every publication, directly to your inbox

Join the 2.082 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.).