Windows Vista Forums

gci and -include and -exclude

  1. #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.   


  3. #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


gci and -include and -exclude
Similar Threads
Thread Forum
MSBuild Include Exclude File List .NET General
Add include/exclude property support to Export-Csv PowerShell
Re: gci internals: which happens first, include or exclude? PowerShell
gci internals: which happens first, include or exclude? PowerShell
Exclude lines that include string PowerShell