Windows 10 now offers an optional case-sensitive file system, just like Linux and other UNIX-like operating systems. All Windows processes will handle case-sensitive files and folders properly if you enable this feature. In other words, they’ll see “file” and “File” as two separate files.
How This Works
This is an NTFS file system feature that you can enable on a per-directory basis. It doesn’t apply to your entire file system, so you can just enable case sensitivity for specific folders you use for development purposes.
Case sensitivity was added in Windows 10’s April 2018 Update. Prior to this, it was possible to mount Windows folders as case sensitive within the Bash on Windows environment, also known as the Windows Subsystem for Linux. That worked fine within the Linux environment, but it confused normal Windows applications. This is now a file-system level feature, which means all Windows applications will see a case sensitive file system in that folder, too.
This feature is enabled via the
fsutil.exe command, which you must run from the command line. You can do it from either a Command Prompt or PowerShell window. With the default settings, folders you create within the Linux environment are automatically configured to be case sensitive, as well.
RELATED: Everything You Can Do With Windows 10's New Bash Shell
How to Set a Directory as Case Sensitive
To get started, right-click the Start button, and then select the “PowerShell (Administrator)” command. If you prefer using the Command Prompt, you can search for “Command Prompt” in your Start menu, right-click it, and then select the “Run as Administrator” command. The command works the same, no matter which command-line environment you choose.
You may not actually need Administrator access to run this command, depending on your permissions. Technically, you need the “write attributes” permission for the directory you want to modify. In most cases, this means that you’ll need Administrator permissions if you want to edit a folder somewhere outside your user folder—such as c:\project—-and not if you want to modify a folder somewhere inside your user folder—such as at c:\users\NAME\project.
Before continuing, be sure that no running Linux software is currently referencing the directory you’re about to modify. You should not change the case sensitivity flag on a folder while Linux software is accessing it. If any running Linux processes currently have the directory or anything inside the directory open, even as their current working directory, Linux applications won’t recognize the change and problems may occur.
To make a folder case sensitive, type the following command, replacing “C:\folder” with the path to the folder:
fsutil.exe file setCaseSensitiveInfo C:\folder enable
If the folder path has a space in it, enclose the whole path in quotation marks, like so:
fsutil.exe file setCaseSensitiveInfo "C:\my folder" enable
This Doesn’t Affect Subfolders
The case sensitivity flag only affects the specific folder to which you apply it. It isn’t automatically inherited by that folder’s subfolders.
In other words, if you have a folder named C:\folder and it has C:\folder\test and C:\folder\stuff subfolders inside it, simply making the C:\folder folder case sensitive wouldn’t also make the “test” and “stuff” subfolders inside it case sensitive. You’d need to run the appropriate
fsutil command separately to make all three folders case sensitive.
Linux Tools Create Case Sensitive Folders by Default
Linux tools you run inside the Windows Subsystem for Linux (Bash shell) now create folders with the case sensitive flag set. So, whether you use the
mkdir command to create a directory inside a Bash shell or a development tool does it for you, the created directory is automatically set as case sensitive—even if you create it on your mounted Windows file system.
Technically, this occurs because the DrvFs file system for the Linux environment uses the
case=dir flag by default. The
case=dir option sets the Linux environment to respect each directory’s NTFS flag, and to automatically set the case sensitivity flag on directories created from within the Linux environment. You can change this option in your wsl.conf file, if you like.
As long as you create folders from the Linux environment, they’re created with the proper case sensitivity settings and you never need to touch the fsutil.exe command.
How to Check if a Directory is Case Sensitive
To check whether a directory is currently case sensitive, run the following command, replacing “C:\folder” with the path to the folder.
fsutil.exe file queryCaseSensitiveInfo C:\folder
If case sensitivity is enabled for a directory, you’ll see that the “Case sensitive attribute on directory [path] is enabled.” If the directory is using the standard Windows case insensitivity, you’ll see that the “Case sensitive attribute on directory [path] is disabled.”
How to Make a Directory Case Insensitive
To undo your change and make a directory case insensitive once again (as Bill Gates intended it), run the following command, replacing “C:\folder” with the path to the folder.
fsutil.exe file setCaseSensitiveInfo C:\folder disable
If you try to disable case sensitivity for a folder that contains files with names that would collide, you’ll see an “Error: The directory is not empty” message. You’ll need to remove or rename the conflicting files before continuing.