Use PowerShell to find blank folders in Windows 10

PowerShell can help you find empty folders in Windows 10 very easily. Only a few command lines are needed.

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 PowerShell command and list all the empty folders it finds in specific locations that you have specified. In this command you can set the search to be performed on an entire drive or 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 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.



Subscribe to the Blog via Email

Enter your email to subscribe to the email notification service for new posts.

Read them Technology News from all over the world, with the validity of

Follow us on Google News at Google news