1

Run Get-ChildItem -Path . -Filter '*.sql' on folders with two files: 001.sql_bk and 010.sql, and the output is as below. File 001.sql_bk is not expected in output.

...
Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a----        2023/02/09     11:09            141 001.sql_bk
-a----        2023/02/09     11:14            187 010.sql

The Version of Windows PowerShell is:

Name                           Value
----                           -----
PSVersion                      5.1.19041.2364
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.19041.2364
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

On PowerShell 7.3, the output is as expected:

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a---          2023/02/09    11:14            187 010.sql
aruku7230
  • 843
  • 8
  • 20
  • this is a bug in dotnet framework, you would see the same if you attempt to call the api: `(gi .).EnumerateFiles('*.sql')` in cases like this you can use `-Include`: `gci .\* -include *.txt` – Santiago Squarzon Feb 09 '23 at 02:59
  • 1
    @Santiago, it's not a bug per se, but "legacy quirks" for the sake of backward compatibility, some of which still affect PowerShell Core as well. Indeed, letting PowerShell perform the wildcard matching avoids the problem. – mklement0 Feb 09 '23 at 03:32

0 Answers0