![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | fileinfosystem members how do i use powershell to make use of the above class to get a file EXTENSION ? EXTENSION is a property. |
My System Specs![]() |
| | #2 (permalink) | ||||||||||||
| Guest | Re: fileinfosystem members The above class doesn't exist, I guess you meant 'System.IO.FileInfo' ![]() You can get a file extension with get-childitem get-childitem *.* | foreach {$_.extension} Or by using the underlying NET type get-childitem is using: ([System.IO.FileInfo]"C:\Scripts\test.txt").extension get-childitem *.* | foreach { ([System.IO.FileInfo]$_).extension } Or with System.IO.Path GetExtension method get-childitem *.* | foreach { [System.IO.Path]::GetExtension($_) } ----- Shay Levi $cript Fanatic http://scriptolog.blogspot.com
| ||||||||||||
My System Specs![]() | |||||||||||||
| | #3 (permalink) | ||||||||||||||||||||||||
| Guest | Re: fileinfosystem members "Shay Levi" <no@xxxxxx> wrote in message news:8766a9441d3c48ca320cf9b07164@xxxxxx
by both DirectoryInfo and FileInfo. That is where Extension and a number of other members common to both directories and files are defined. BTW one of my favorite things to do with extension is group by it: get-childitem -r | group Extension | sort count -desc
DirectoryInfo encountered. :-( -- Keith | ||||||||||||||||||||||||
My System Specs![]() | |||||||||||||||||||||||||
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| to enumerate all the members of a object | M | .NET General | 2 | 03-01-2008 02:51 AM |
| Members of Group | Nick | PowerShell | 9 | 02-28-2008 09:49 AM |
| How can I search for other members? | Johnny Jet | Live Messenger | 1 | 12-01-2007 04:35 PM |