What expressions can you specify in the -filter param for dir


  1.    28 Aug 2007 #1
    Bob Landau Guest

    What expressions can you specify in the -filter param for dir


    I'm trying to better understand what expressions can be used in the -filter
    parameter for the get-childitem cmdlet.

    I've looked in the following helpfiles

    get-childitem
    about_wildcards
    about_providers
    < and a few others>

    The documentation for get-childitem states the syntax and use of wildcards
    for the filter parameter is dependant on the provider.

    The documentation for about_wildcards states that besides the well know * ?
    wildcards you can use ranges and sets.

    The documentation for about_provider did not address this.

    Below is what I've found by experimentation


    c:> cd \windows\system32
    c:\windows\system32>: get-childitem -filter a?* # works as expected

    c:\windows\system32>: get-childitem [a-b]?* # works as expected

    c:\windows\system32>: get-childitem -filter [a-b]?* # doesn't work


    Does the "provider" not provide this type of wildcard? Bug?


    How are you suppose to know what you can use; trial and error?

    I'm hoping that someone can point to some documentation that shows what
    syntax each provider can use in the -filter parameter

    thanks again

    bob
      My System SpecsSystem Spec

  2.    28 Aug 2007 #2
    Kiron Guest

    Re: What expressions can you specify in the -filter param for dir


    Get-ChildItem's -filter, -include, -exclude accept wildcards '*,?', no regex
    patterns nor ranges. Ranges are passed to the -path parameter.

    get-childitem -path [a-b]?* # should work

    --
    Kiron

      My System SpecsSystem Spec

  3.    28 Aug 2007 #3
    Bob Landau Guest

    Re: What expressions can you specify in the -filter param for dir


    I appreciate the response however this is not what I've found to be the case.
    From what the doc state

    -include, -exclude

    are both process by Powershell itself so are capable of handling regex.

    -filter however is an escape mechanism which passes the processing to the
    provider.

    Try this

    c:\windows\system32> get-childitem *.* -include [a-z]?*.dll -exclude
    [abcdefghijklmn]?*.*


    This works as expected. The problem evidently is no one other than a few
    Microsoft developers and possibly testors know absolultely what is allowed
    for the filter parameter.

    Oh well, I'm sure the doc's well get better

    bob

    "Kiron" wrote:

    > Get-ChildItem's -filter, -include, -exclude accept wildcards '*,?', no regex
    > patterns nor ranges. Ranges are passed to the -path parameter.
    >
    > get-childitem -path [a-b]?* # should work
    >
    > --
    > Kiron
    >
      My System SpecsSystem Spec

What expressions can you specify in the -filter param for dir

Similar Threads
Thread Forum
Filter Multicast & Filter Internet NAT Redirection settings question
I am using an old wired Linksys BEFSR41 V3 Router to increase my security. I looked up my cable modem and it is not a router nor does it contain a...
Vista security
Junk Filter doesn't filter
I keep getting same junk mail over and over even after marking the mail as junk. Why doesn't the junk filter work? I have made sure it was enabled.
Live Mail
Using param with InvokeReturnAsIs
I can't seem to use param when invoking a scriptblock using InvokeReturnAsIs. Also, the same problem occurs when using a PSScriptMethod. Here are...
PowerShell
param VS dotsourcing
hello, i would like to use some fonctions of a dot-sourced file and get all the parameters setted in the command line at the same time; how to...
PowerShell
Regular expressions
I'd like to take these 2 general strings and replace them: email@email.com "email@email.com" <domain@domain.com> 148> $string=email@email.com...
PowerShell
help. Digital filter? how to de-filter? USB audio device
Dear All, It is for sure that when I send audio data down to USB audio device, Vista add a digital filter there between. This destroy our...
Vista hardware & devices
Info: Param vs $args
Pros? Cons? Preference?
PowerShell

Our Sites
  • Ten Forums
  • Eight Forums
  • Seven Forums
  • Help Me Bake
  • Site Links
  • Contact Us
  • Privacy and Cookies
  • Old server
    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 12:31.
    .