easiest way to read all lines from all files in a directory in powershell
https://stackoverflow.com/questions/2541693
Solution
Well you don't want to throw directories at Get-Content. Try this to filter out dirs:
Get-ChildItem | Where {!$_.PSIsContainer} | Get-Content
or using aliases:
gci | ?{!$_.PSIsContainer} | gc
Also note that Get-Content takes the filename as pipeline input so you don't need the Foreach-Object cmdlet. You can pipe directly to Get-Content.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow