To filter folder content by file or folder, check whether the Length property is present. It is present for files and missing in folders:
Dir $env:windir | Where-Object { $_.Length -eq $null } Dir $env:windir | Where-Object { $_.Length -ne $null }
To filter folder content by file or folder, check whether the Length property is present. It is present for files and missing in folders:
Dir $env:windir | Where-Object { $_.Length -eq $null } Dir $env:windir | Where-Object { $_.Length -ne $null }