![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
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 | get-childitem bug? I seems to me that the -include option doesn't work for a file extension. In my output ( below) get-childitem finds the files in the current directory. When I apply the -include foo* for a file NAME, it finds the files with the pattern/wildcard. When I apply the -include *.txt no files are found ( see last line below). Is it just me? Thanks for input or confirmation. ------------------------------------------------------------------------------------- PS C:\Temp\foodir> get-childitem Directory: Microsoft.PowerShell.Core\FileSystem::C:\Temp\foodir Mode LastWriteTime Length Name ---- ------------- ------ ---- -a--- 2/29/2008 9:59 AM 46 foo.txt -a--- 2/29/2008 10:00 AM 21 foo2 -a--- 2/29/2008 9:57 AM 9 foo2.txt PS C:\Temp\foodir> get-childitem . Directory: Microsoft.PowerShell.Core\FileSystem::C:\Temp\foodir Mode LastWriteTime Length Name ---- ------------- ------ ---- -a--- 2/29/2008 9:59 AM 46 foo.txt -a--- 2/29/2008 10:00 AM 21 foo2 -a--- 2/29/2008 9:57 AM 9 foo2.txt PS C:\Temp\foodir> get-childitem . -include foo* Directory: Microsoft.PowerShell.Core\FileSystem::C:\Temp\foodir Mode LastWriteTime Length Name ---- ------------- ------ ---- -a--- 2/29/2008 9:59 AM 46 foo.txt -a--- 2/29/2008 10:00 AM 21 foo2 -a--- 2/29/2008 9:57 AM 9 foo2.txt *** Next line returns NO OUTPUT **** PS C:\Temp\foodir> get-childitem . -include *.txt PS C:\Temp\foodir> |
| | #2 (permalink) | ||||||||||||
| Guest | Re: get-childitem bug? Check te help for get-childitem include parameter: -include <string[]> Retrieves only the specified items. The value of this parameter qualifies the Path parameter. Enter a path element or pattern, such as "*.txt". Wildcards are permitted. The Include parameter is effective only when the command includes the Recurse parameter or the path leads to the contents of a dire ctory, such as C:\Windows\*, where the wildcard character specifies the contents of the C:\Windows directory. That said, this should fix the problem: get-childitem .\* -include *.txt ----- Shay Levi $cript Fanatic http://scriptolog.blogspot.com
| ||||||||||||
| | #3 (permalink) | ||||||||||||||||||||||||
| Guest | Re: get-childitem bug? Shay, thanks. The qualified -path does solve the issue. I did read the help originally, and I used Example 2 - (( C:\PS>get-childitem . -Include *.txt -Recurse )) which does not follow the Qualified -path requirement. It seems inconsistent if one -include pattern works, and another -include pattern doesn't work, when in both cases, the -path is not fully qualified. Maybe better in 2.0... I appreciate your help. "Shay Levi" wrote:
| ||||||||||||||||||||||||
| |
| |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| get-childitem -exclude bug | bep | PowerShell | 7 | 03-11-2008 07:47 PM |
| using Get-ChildItem | foamy | PowerShell | 9 | 02-15-2008 04:32 AM |
| get-childitem | Brandon Shell [MVP] | PowerShell | 4 | 12-03-2007 12:58 PM |
| Registry and Get-ChildItem | fixitchris | PowerShell | 7 | 11-14-2006 06:02 PM |
| Problem with Get-ChildItem | Gary | PowerShell | 3 | 09-26-2006 08:23 PM |