gci and -include and -exclude

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

gci and -include and -exclude
 Similar Threads Thread Forum .NET General PowerShell PowerShell PowerShell PowerShell