Closed
Description
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest released version
- Search the existing issues.
- Refer to the FAQ.
- Refer to Differences between Windows PowerShell 5.1 and PowerShell.
Steps to reproduce
This occurs on both windows and linux, starting at v5 all the way through to now.
<#System.IO.FileInfo#> | %{ $_.BaseName + $_.Extension }
should always be equivalent to <#System.IO.FileInfo#>.Name
For gci -File
this holds true.
For gci -Directory
although pwsh correctly has .BaseName
always match .Name
(folders cannot have extensions..), .Extension
incorrectly matches .Name -replace '^.*?(?=\.[^.]*$|$)',''
instead of always returning ""
Expected behavior
PS> (New-Item -Type Directory -Name 'bob.steve 123_456[yoyo]').Extension
PS>
Actual behavior
PS> (New-Item -Type Directory -Name 'bob.steve 123_456[yoyo]').Extension
.steve 123_456[yoyo]
PS>
Error details
No response
Environment data
Name Value
---- -----
PSVersion 7.4.2
PSEdition Core
GitCommitId 7.4.2
OS Fedora Remix for WSL
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0