X

How to Check if a Folder is Empty in PowerShell

When you are required to check a folder if it is really empty or not with Powershell, this tutorial can help you a lot.

Check if a Folder is Empty in PowerShell

Open PowerShell with administrative privileges and execute the following script.

if( (Get-ChildItem C:\temp | Measure-Object).Count -eq 0)
{
 echo "Folder is empty"
} else { echo "Folder is not empty" }
Karim Buzdar: About the Author: Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications. As an IT engineer and technical author, he writes for various websites.
X

Headline

You can control the ways in which we improve and personalize your experience. Please choose whether you wish to allow the following:

Privacy Settings