I would like to search for folders with a certain number of files, but currently I cannot figure out the syntax on how to achieve this. I have searched the Windows Search site, but have only found document specific syntax. I am trying to organize my files between multiple devices and it is becoming a pain to have to look at each folder, just to see the amount of files. Can you help me?
OS Used: Microsoft Windows 7 Home Premium Edition Service Pack 1 (build 7601), 64-bit Update-
$NumFiles = 4
$Directory = (Get-ChildItem "C:\Windows*" -ErrorAction -force)
Get-ChildItem -path $Directory -recurse -include *.exe `
| Sort-Object Name | Format-Table Name, Fullname -auto
$NumFiles + (Get-ChildItem "C:\Windows").Count