Skip to content

Regression: Get-ChildItem -File -Filter *. no longer finds extension-less files on Windows #9330

@mklement0

Description

@mklement0

in Windows PowerShell and v6.1.3 you can match files that don't have a filename extension with provider filter -Filter *..

This doesn't work anymore.

Note that -Filter ultimately uses the underlying Windows API for wildcard matching, which has legacy quirks, including the ability to match extension-less filenames with *.; it is not the same wildcard language as PowerShell's own (and *. wouldn't work that way with, say, -Include).

Steps to reproduce

Run the following test on Windows:

Describe "Extension-less file filtering"  {
  It "-Filter *. finds extension-less files" -Skip:(!$IsWindows) {
      '' > TestDrive:/foo
      (Get-ChildItem -File -LiteralPath TestDrive:/ -Filter *.).Name | Should -Be foo
  }
}

Expected behavior

The test should pass.

Actual behavior

The test fails.

Environment data

PowerShell Core v6.2.0 (6.2.0) on Microsoft Windows 10 Pro (64-bit; Version 1803, OS Build: 17134.706)

Metadata

Metadata

Assignees

Labels

Issue-BugIssue has been identified as a bug in the productResolution-FixedThe issue is fixed.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions