1.    14 May 2010 #1
    Dan Holmes Guest

    gci and -include and -exclude


    I am trying get a limited set of files from a directory tree. The following is what i want but it doesn't work. I get
    everything.


    get-childitem -LiteralPath \rm5_0_code_h\source -include *.frm,*.ctl,*.bas,*.cls,*.cs,*.cpp,*.hpp,*.sql,*.java -Recurse


    I have even tried to exclude what i don't want but it doesn't seem to matter.

    get-childitem -LiteralPath $path -include *.frm,*.ctl,*.bas,*.cls,*.cs,*.cpp,*.hpp,*.sql,*.java -recurse -exclude
    *alter*.sql,*.dll,*.pdb,*.ncb,*.tlb,*.scc,*.bmp,*.ico

    i still get them all. what am i doing wrong?

    dan
      My System SpecsSystem Spec

  2.    14 May 2010 #2
    Michael Soza Guest

    Re: gci and -include and -exclude


    you have to ask for all files and then filter with the include. Example:
    ls * -include *.exe #ask for all files in the actual dir and then apply
    the filter.

    You miss the first *


    "Dan Holmes" <dan.holmes@newsgroup> wrote in message
    news:#TXQtO38KHA.3840@newsgroup

    > I am trying get a limited set of files from a directory tree. The
    > following is what i want but it doesn't work. I get everything.
    >
    >
    > get-childitem -LiteralPath \rm5_0_code_h\source -include
    > *.frm,*.ctl,*.bas,*.cls,*.cs,*.cpp,*.hpp,*.sql,*.java -Recurse
    >
    >
    > I have even tried to exclude what i don't want but it doesn't seem to
    > matter.
    >
    > get-childitem -LiteralPath $path -include
    > *.frm,*.ctl,*.bas,*.cls,*.cs,*.cpp,*.hpp,*.sql,*.java -recurse -exclude
    > *alter*.sql,*.dll,*.pdb,*.ncb,*.tlb,*.scc,*.bmp,*.ico
    >
    > i still get them all. what am i doing wrong?
    >
    > dan
      My System SpecsSystem Spec


Similar Threads
Thread Forum
MSBuild Include Exclude File List
I've been googling (:::::err binging) for a bit now, and cannot figure out the magic syntax. C:\MySolution1\ C:\MySolution1\MyProject1\...
.NET General
Add include/exclude property support to Export-Csv
To have a subset of object properties exported to a csv file we need to select the properties first with select-object and then pipe to export-csv:...
PowerShell
using exclude to exclude files and folders
Hi, I am trying to set up a script to clear out folders and files within those folders in the directory c:\work\test that were accessed more than...
PowerShell
Re: gci internals: which happens first, include or exclude?
To be clear here... While I am playing with the reflector and it does provide the information requested, I am not comfortable enough to provide...
PowerShell
gci internals: which happens first, include or exclude?
It doesn't matter from the perspective of results, of course, but does anyone know offhand which of Include and Exclude is applied first when both...
PowerShell
One more question on -LiteralPath and -Include/-Exclude for GetChi
The grammer for Get-ChildItem states that -Include/-Exclude are valid for either the -Path or -LiteralPath parameter. Does anyone know whether this...
PowerShell
Exclude lines that include string
I'm trying to get a list of all users in AD except ones in OUs "foo" and "fum", while also excluding disabled accounts. I'm having two problems...
PowerShell

Our Sites
  • Ten Forums
  • Eight Forums
  • Seven Forums
  • PC Help Forum
  • Help Me Bake
  • Site Links
  • Contact Us
  • Privacy and Cookies
  • About Us
    Windows Vista Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

    Designer Media Ltd
    All times are GMT -5. The time now is 17:09.
    .