Unexplained case sensitivity with Test-Path

This topic contains 3 replies, has 2 voices, and was last updated by Profile photo of Don Jones Don Jones 1 month ago.

  • Author
    Posts
  • #66859
    Profile photo of Joel Newton
    Joel Newton
    Participant

    Hi,

    I was surprised to find, when doing a Test-Path check on UNC paths, that the result PowerShell gave was case-sensitive. The paths I'm testing are on a Nexenta storage device. Does the type of device or some response from the device affect the results of Test-Path?

    Thanks,
    Joel

  • #66862
    Profile photo of Don Jones
    Don Jones
    Keymaster

    Yeah. The command just asks the file system if the path exists. If the file system cares about case, then it acts accordingly. Most *nix file systems are case sensitive.

    • #66868
      Profile photo of Joel Newton
      Joel Newton
      Participant

      Thanks, Don. Good to know, though even better to know would be how to identify if the file system a path uses is *nix or not. I don't see that Get-Item returns anything that would shed light on this.

  • #66871
    Profile photo of Don Jones
    Don Jones
    Keymaster

    The file systems actually have no interface for revealing that. And it's more nuanced because, for example, some Linux SMB layers abstract it and remove case sensitivity.

    You could easily write a simple test tho. Just test for a known existing path using lowercase and uppercase. If both return true then it isn't sensitive. If only one returns true then it is.

You must be logged in to reply to this topic.