title: How can Get-ChildItem be tested for no results (zero files)?
body: <p>I'm stumped here on what seems to be a simple problem; so sorry for any bone-headed-ness over here.</p>
  
  <p>I have script that cleans up defunct backup files.  After identifying the files I loop over and print out what's being dumped.   My problem arises trying to provide feedback/testing when there are zero defunct files.  The script looks like...</p>
  
  <pre><code>$Files = Get-ChildItem $BackupPath_Root -include *.bak -recurse 
             | where {$_.CreationTime  -le $DelDate_Backup }  
  
  if ( $Files -eq "" -or $Files.Count  -eq 0 ) {
      write-host "   no files to delete."    #&lt;-- this doesn't print when no files
  } else {
     foreach ($File in $Files) {
        write-host “$File” 
        Remove-Item $File | out-null
     } 
  }
  </code></pre>
  
  <p>The if checking for no files doesn't catch the no file condition.  What is the appropriate way to test <code>$Files</code> for no results ?</p>