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" }