Windows 10 – How to Access Case-Sensitive Paths Created with Bash on Ubuntu on Windows

bashfilesystemswindows 10windows-explorerwindows-subsystem-for-linux

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.

Best Answer

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://docs.microsoft.com/en-us/windows/wsl/release-notes#build-14361

Related Question