Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use Powershell to list the Fully Pathed Filenames on Individual Separate Lines?

If I execute:

Get-ChildItem *.ext -recurse 

the output consists of a series of Directory sections followed by one or more columns of info for each matching file separated by said directory sections. Is there something like the Unix find command? In which each matching file name appears on a single line with its full relative path?

like image 456
Tim Hanson Avatar asked Mar 02 '23 20:03

Tim Hanson


1 Answers

Get-Childitem by default outputs a view for format-table defined in a format xml file somewhere.

get-childitem | format-table
get-childitem | format-list *

shows you the actual properties in the objects being output. See also How to list all properties of a PowerShell object . Then you can pick and choose the ones you want. This would give the full pathname:

get-childitem | select fullname

If you want an output to be just a string and not an object:

get-childitem | select -expand fullname
get-childitem | foreach fullname
like image 51
js2010 Avatar answered Apr 07 '23 02:04

js2010