TechTalkz.com Logo

Go Back   TechTalkz.com Technology & Computer Troubleshooting Forums > Tech Support Archives > Microsoft > Microsoft Windows Powershell

Notices

understanding get-childitem -include

Microsoft Windows Powershell


Reply
 
Thread Tools Display Modes
Old 17-05-2008, 11:50 AM   #1
Leo Tohill
Guest
 
Posts: n/a
understanding get-childitem -include

I have a directory "c:\temp" with files like "qa_1.mdf" and qa_2.mdf"

get-childitem c:\temp
shows them

get-childitem c:\temp -include qa*
shows them

get-childitem c:\temp -include *.mdf
does not.

why?


I've read the doc that "The Include parameter is effective only when the
command includes the Recurse parameter or the path leads to the contents of
a directory, such as C:\Windows\* ..."

Which I can accept without understanding, but I'd rather understand it. If
the path is simply "c:\temp", how is the -include interpreted?





  Reply With Quote
Old 19-05-2008, 07:51 AM   #2
Marco Shaw [MVP]
Guest
 
Posts: n/a
Re: understanding get-childitem -include

Leo Tohill wrote:
> I have a directory "c:\temp" with files like "qa_1.mdf" and qa_2.mdf"
>
> get-childitem c:\temp
> shows them
>
> get-childitem c:\temp -include qa*
> shows them
>
> get-childitem c:\temp -include *.mdf
> does not.
>
> why?
>
>
> I've read the doc that "The Include parameter is effective only when the
> command includes the Recurse parameter or the path leads to the contents of
> a directory, such as C:\Windows\* ..."
>
> Which I can accept without understanding, but I'd rather understand it. If
> the path is simply "c:\temp", how is the -include interpreted?


Without the source, there's not a whole lot we can tell you but make
general assumptions about what the issue might be.

Hopefully you understand that probably only Microsoft will only be able
to comment really.

Let's see if someone comes online in the next week or 2, then maybe we/I
can try to get an answer otherwise.

Marco

--
Microsoft MVP - Windows PowerShell


PowerGadgets MVP


Blog:

  Reply With Quote
Old 20-05-2008, 01:57 AM   #3
Rats
Guest
 
Posts: n/a
Re: understanding get-childitem -include

"Marco Shaw [MVP]" <> wrote in message
news:.gbl...
> Leo Tohill wrote:
>> I have a directory "c:\temp" with files like "qa_1.mdf" and qa_2.mdf"
>>
>> get-childitem c:\temp shows them
>>
>> get-childitem c:\temp -include qa*
>> shows them
>>
>> get-childitem c:\temp -include *.mdf
>> does not.
>>
>> why?
>>
>>
>> I've read the doc that "The Include parameter is effective only when the
>> command includes the Recurse parameter or the path leads to the contents
>> of a directory, such as C:\Windows\* ..."
>>
>> Which I can accept without understanding, but I'd rather understand it.
>> If the path is simply "c:\temp", how is the -include interpreted?

>
> Without the source, there's not a whole lot we can tell you but make
> general assumptions about what the issue might be.
>
> Hopefully you understand that probably only Microsoft will only be able to
> comment really.
>
> Let's see if someone comes online in the next week or 2, then maybe we/I
> can try to get an answer otherwise.
>
> Marco
>
> --
> Microsoft MVP - Windows PowerShell
>
>
> PowerGadgets MVP
>
>
> Blog:
>


I created "qa_1.mdf" and qa_2.mdf" in my c:\temp directory

get-childitem c:\temp
shows them

get-childitem c:\temp -include qa*
does not show them

get-childitem c:\temp -include *.mdf
does not show them.

BUT if I use a wildcard after c:\temp
get-childitem c:\temp\* -include qa*
get-childitem c:\temp\* -include *.mdf
both show the files.

I believe it is an idiosyncrasy with the underlying operating system. I have
seen this as far back as the days of DOS3.0 which is why when doing anything
with the contents of a directory, use a wildcard to include all the items,
then use the "-include" to parse the dataset.

I really don't think this is a Powershell problem as much as the core
operating system.



--
Ray



  Reply With Quote
Reply

Thread Tools
Display Modes



< Windows Help - MS Office Help - Hardware Support >


New To Site? Need Help?

All times are GMT +5.5. The time now is 08:19 AM.


vBulletin, Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO
Copyright © 2005-2009, TechTalkz.com. All Rights Reserved - Privacy Policy
Valid XHTML 1.0 Transitional