How to get Select-Object to return a raw type (e.g. String) rather than PSCustomObject?
You just need to pick out the property you want from the objects. FullName in this case. $files = Get-ChildItem $directory -Recurse | Select-Object FullName | Where-Object {!($_.psiscontainer)} | foreach {$_.FullName} Edit: Explanation for Mark, who asks, “What does the foreach do? What is that enumerating over?” Sung Meister’s explanation is very good, but I’ll … Read more