![]() |
|
|
#1 |
|
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? |
|
|
|
#2 |
|
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 http://www.microsoft.com/mvp PowerGadgets MVP http://www.powergadgets.com/mvp Blog: http://marcoshaw.blogspot.com |
|
|
|
#3 |
|
Guest
Posts: n/a
|
Re: understanding get-childitem -include
"Marco Shaw [MVP]" <marco.shaw@_NO_SPAM_gmail.com> wrote in message
news:OyrjDfUuIHA.1316@TK2MSFTNGP06.phx.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 > http://www.microsoft.com/mvp > > PowerGadgets MVP > http://www.powergadgets.com/mvp > > Blog: > http://marcoshaw.blogspot.com 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 |
|
![]() |
| Tags: |
| Thread Tools | |
| Display Modes | |
|
|