Discussion:
how to get subdir items with full path name?
(too old to reply)
Benny
2006-10-18 07:33:59 UTC
Permalink
I'm new to powershell,

How to get subdir items with full path name?


Thank you!
ClaudioG64
2006-10-18 10:03:12 UTC
Permalink
Post by Benny
I'm new to powershell,
How to get subdir items with full path name?
Thank you!
Some examples.

For a specific Path:
get-childitem C:\ | foreach-object -process { $_.FullName }
get-childitem -recurse | foreach-object -process { $_.FullName }
get-childitem -recurse -force | foreach-object -process { $_.FullName }

Ciao!
Claudio
dreeschkind
2006-10-18 12:23:01 UTC
Permalink
I just like to add that there are also some shortcuts that are not so verbose:

:)
Post by ClaudioG64
get-childitem C:\ | foreach-object -process { $_.FullName }
gci C:\ | % { $_.FullName }
Post by ClaudioG64
get-childitem -recurse | foreach-object -process { $_.FullName }
gci -r | % { $_.FullName }
Post by ClaudioG64
get-childitem -recurse -force | foreach-object -process { $_.FullName }
gci -r -fo | % { $_.FullName }

--
greetings
dreeschkind
Jeffrey Snover
2006-10-21 04:13:00 UTC
Permalink
Here is one for you:

${function:...} = { process { $_.($args[0]) } }

gci c:\ | ... fullname

Enjoy!

Keith Hill [MVP]
2006-10-19 04:40:44 UTC
Permalink
Post by Benny
I'm new to powershell,
How to get subdir items with full path name?
If you want just the name (ie a string object is OK) then just use:

gci . -name

or

gci . -recurse -name

Be aware that this will emit System.String objects instead of
System.IO.FileInfo/DirectoryInfo.

--
Keith
Loading...