Powershell test if folder empty

powershell

Solution

Try this...

$directoryInfo = Get-ChildItem C:\temp | Measure-Object
$directoryInfo.count #Returns the count of all of the objects in the directory

If `$directoryInfo.count -eq 0`, then your directory is empty.

Problem

In Powershell, how do I test if a directory is empty?

Original source

Related problems