PowerShell / PowerShell

PowerShell for every system!
https://microsoft.com/PowerShell
MIT License
43.66k stars 7.08k forks source link

Get-ChildItem overwrites a file's Name property #21646

Open dt1ll0ts0n opened 3 weeks ago

dt1ll0ts0n commented 3 weeks ago

Prerequisites

Steps to reproduce

I am experienceing an issue with Get-ChildItem. When I use the -Path parameter, and include a filename that is in a diFfErEnt casing than the existing file, GCI returns the file with my diFfErEnt cased name as the Name property.

Expected behavior

PS>gci -Path fileNAME.txt | Select Name
Name
----
FileName.txt

Actual behavior

PS>gci -Path fileNAME.txt | Select Name
Name
----
fileNAME.txt

Error details

No response

Environment data

Name                           Value
----                           -----
PSVersion                      7.4.1
PSEdition                      Core
GitCommitId                    7.4.1
OS                             Microsoft Windows 10.0.19045
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Visuals

image

mklement0 commented 3 weeks ago

Good point; this was first reported and discussed at length in:

dt1ll0ts0n commented 3 weeks ago

Wow - what a ride that discussion was. Clearly nothing came of it, though.

Thanks for including my voice in the chorus, @mklement0 .