What is the FileSystem provider filter syntax?

Question:

Get-Help Get-ChildItem displays -Filter parameter, with displayed wording “Specifies a filter in the provider’s format or language“. That language differs between what Powershell calls “providers”, and file system is declared as one of them. But I have not found any syntax descriptions on file system provider’s filter syntax. Any help?

Answer:

The filter syntax supported by the FileSystem provider is sparsely (if it all) documented, probably because there’s nothing much to say.

In short, it only supports simple wildcard matching as you know it from Windows XP-era Search:

Any file with an extension:

Any file with the .txt extension:

Partial wildcard matching:

Single-character matching (matches myfile1.jpg but not myfile01.jpg):

Simple character sets (this matches bear and beer):

Simple character ranges (this matches filea.txt, fileb.txt and filec.txt):


Note: It only supports a single expression per filter, so this is illegal:

Source:

What is the FileSystem provider filter syntax? by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply