Reputation: 531
I am trying to get the extended attributes of certain files and am unsure why select will not work in the pipeline.
This does not work
gci -r |? {$_.lastwritetime -gt '12/30/16'} |% {Get-ItemProperty $_} |FT -Property * -Force |select basename, directory
However this returns data, select just wont grab it:
gci -r |? {$_.lastwritetime -gt '12/30/16'} |% {Get-ItemProperty $_} |FT -Property * -Force
Upvotes: 1
Views: 82
Reputation: 2342
When you pass the object to Format-Table, FT, you convert it to a pretty table, but not a pretty object. So you will struggle to manipulate it. Either use Format-Table -Propert BaseName,Directory OR Move the select before the Format-Table.
Aliases are bad for learning. Here is an example though:
Get-ChildItem -Recurse `
| Where-Object -Property LastWriteTime -GT '12/30/16' `
| ForEach-Object { Get-ItemProperty $_.FullName } `
| Format-Table -Property Basename,Directory -Force
Upvotes: 1