How can I access case-sensitive paths on Windows (created with Bash-on-Ubuntu-on-Windows)?

5

1

Bash-on-Ubuntu-on-Windows supports case-sensitive file paths. This means that I can create two files or directories with names only differing in capitalization. I have issues accessing those files, though.

Running

bash -c "touch Magic ; mkdir magic ; echo Secret! > magic/secret"

Creates a file names Magic, a directory named magic and a file names secret in that directory.

bash -c "ls -lR" yields

.:
total 0
drwxrwxrwx 2 root root 0 Aug 23 10:37 magic
-rwxrwxrwx 1 root root 0 Aug 23 10:37 Magic

./magic:
total 0
-rwxrwxrwx 1 root root 8 Aug 23 10:37 secret

(I am not sure why I get root, as it is not the default user, but that does not seem relevant to my question.)

Windows Explorer shows: Windows Explorer shows file and directory

Now, while bash can easily access the magic/secret file in the directory, Windows seems to treat both the directory and the file as one and the same. So double-clicking the directory I get a "directory name invalid" error Error dbl-clicking directory

Same goes for using cd, as I get The directory name is invalid. printed out.

Is there any way (other than using Bash) to access the magic/secret file?

Partial Answer

I've found a way to do it programmatically, with some registry changes. Described here. But it seems that there is no way to do it with existing Windows tooling.

tmr232

Posted 2016-08-23T07:58:03.790

Reputation: 153

Did you try a third party file explorer like Total Commander and/or PowerShell? – Seth – 2016-11-07T08:39:58.360

No, I did not. Bu I don't think anything works without the registry change. – tmr232 – 2016-11-07T12:43:02.407

Answers

1

You can't access to those folders in Explorer, simply because the Win32 subsystem doesn't support case sensitivity, and Explorer doesn't support POSIX subsystem

Build 14361

For general Windows information on build 14361 visit the Windows Blog.

To track or report an issue visit our Github page.

Fixed

  • DrvFs is now case sensitive when running in Bash on Ubuntu on Windows.

    • Users may case.txt and CASE.TXT on their /mnt/c drives
    • Case sensitivity is only supported within Bash on Ubuntu on Windows. When outside of Bash NTFS will report the files correctly, but unexpected behavior may occur interacting with the files from Windows.
    • The root of each volume (i.e. /mnt/c) is not case sensitive
    • More information on handling these files in Windows can be found here.

https://msdn.microsoft.com/en-us/commandline/wsl/release_notes#build-14361

phuclv

Posted 2016-08-23T07:58:03.790

Reputation: 14 930