This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can trysigning in orchanging directories.
Access to this page requires authorization. You can trychanging directories.
Case sensitivity determines whether uppercase (FOO.txt) and lowercase (foo.txt) letters are handled as distinct (case-sensitive) or equivalent (case-insensitive) in a file name or directory.
When working with both Linux and Windows files and directories, you may need to adjust how case sensitivity is handled.
Standard behavior:
The Windows file system supports setting case sensitivity with attribute flags per directory. While the standard behavior is to be case-insensitive, you can assign an attribute flag to make a directory case sensitive, so that it will recognize Linux files and folders that may differ only by case.
This may be especially true when mounting drives to the Windows Subsystem for Linux (WSL) file system. When working in the WSL file system, you are running Linux, thus files and directories are treated as case-sensitive by default.
Note
In the past, if you had files whose name differed only by case, these files could not be accessed by Windows, because Windows applications treat the file system as case insensitive and cannot distinguish between files whose names only differ in case. While Windows File Explorer will show both files, only one will open regardless of which you select.
The following steps explain how to change a directory on the Windows file system so that it is case-sensitive and will recognize files and folders that differ only by case.
Warning
Some Windows applications, using the assumption that the file system is case insensitive, don’t use the correct case to refer to files. For example, it’s not uncommon for applications to transform filenames to use all upper or lower case. In directories marked as case sensitive, this means that these applications can no longer access the files. Additionally, if Windows applications create new directories in a directory tree where you are using case sensitive files, these directories are not case sensitive. This can make it difficult to work with Windows tools in case sensitive directories, so exercise caution when changing Windows file system case-sensitivity settings.
To check if a directory is case sensitive in the Windows filesystem, run the command:
fsutil.exe file queryCaseSensitiveInfo <path>Replace<path> with your file path. For a directory in the Windows (NTFS) file system, the<path> will look like:C:\Users\user1\case-test or if you are already in theuser1 directory, you could just run:fsutil.exe file setCaseSensitiveInfo case-test
Support for per-directory case sensitivity began in Windows 10, build 17107. In Windows 10, build 17692, support was updated to include inspecting and modifying the case sensitivity flag for a directory from inside WSL. Case sensitivity is exposed using an extended attribute namedsystem.wsl_case_sensitive. The value of this attribute will be 0 for case insensitive directories, and 1 for case sensitive directories.
Changing the case-sensitivity of a directory requires that you runelevated permissions (run as Administrator). Changing the case-sensitivity flag also requires “Write attributes”, “Create files”, “Create folders” and “Delete subfolders and files” permissions on the directory.See the troubleshooting section for more about this.
To change a directory in the Windows file system so that it is case-sensitive (FOO ≠ foo), run PowerShell as Administrator and use the command:
fsutil.exe file setCaseSensitiveInfo <path> enableTo change a directory in the Windows file system back to the case-insensitive default (FOO = foo), run PowerShell as Administrator and use the command:
fsutil.exe file setCaseSensitiveInfo <path> disableA directory must be empty in order to change the case sensitivity flag attribute on that directory. You cannot disable the case sensitivity flag on a directory containing folders/files whose names differ on only by case.
When creating new directories, those directories will inherit the case sensitivity from its parent directory.
Warning
There is an exception to this inheritance policy when running in WSL 1 mode. When a distribution is running in WSL 1 mode, the per-directory case sensitivity flag is not inherited; directories created in a case sensitive directory are not automatically case sensitive themselves. You must explicitly mark each directory as case sensitive
Case sensitivity can be managed when mounting a drive on the Windows Subsystem for Linux using the WSL config file. Each Linux distribution that you have installed can have it's own WSL config file, called/etc/wsl.conf. For more information about how to mount a drive, seeGet started mounting a Linux disk in WSL 2.
To configure the case sensitivity option in thewsl.conf file when mounting a drive:
etc folder (this may require you tocd .. up from thehome directory).etc directory to see if awsl.conf file already exists (use thels command, orexplorer.exe . to view the directory with Windows File Explorer).wsl.conf file does not already exist, you can create it using:sudo touch wsl.conf or by runningsudo nano /etc/wsl.conf, which will create the file upon saving from the Nano editor.wsl.conf file:Default setting:off for case sensitivity unavailable (all directories on mounted NTFS drives will be case insensitive).
[automount]options = case = offEnabling case sensitivity per directory:dir
[automount]options = case = dirTreat all directories on the (NTFS) drive as case sensitive:force
[automount]options = case = forceThis option is only supported for mounting drives on Linux distributions running as WSL 1 and may require a registration key. To add a registration key, you can use this command from an elevated (admin) command prompt:reg.exe add HKLM\SYSTEM\CurrentControlSet\Services\lxss /v DrvFsAllowForceCaseSensitivity /t REG_DWORD /d 1.
You will need to restart WSL after making any changes to thewsl.conf file in order for those changes to take effect. You can restart WSL using the command:wsl --shutdown
Tip
To mount a drive (which uses the DrvFs filesystem plugin to make the disk available under /mnt, such as /mnt/c, /mnt/d, etc) with a specific case sensitivity setting for ALL drives, use/etc/wsl.conf as described above. To set the default mount options for one specific drive, use the/etc/fstab file to specify these options.For more WSL configuration options, seeConfigure per distro launch settings with wslconf.
NTFS-formatted drives mounted to a WSL distribution will be case-insensitive by default. To change the case sensitivity for a directory on a drive mounted to a WSL distribution (ie. Ubuntu), follow the same steps as listed above for the Windows file system. (EXT4 drives will be case-sensitive by default).
To enable case-sensitivity on a directory (FOO ≠ foo), use the command:
fsutil.exe file setCaseSensitiveInfo <path> enableTo disable case-sensitivity on a directory and return to the case-insensitive default (FOO = foo), use the command:
fsutil.exe file setCaseSensitiveInfo <path> disableNote
If you change the case sensitive flag on an existing directory for a mounted drive while WSL is running, ensure WSL has no references to that directory or else the change will not be effective. This means the directory must not be open by any WSL processes, including using the directory (or its descendants) as the current working directory.
The Git version control system also has a configuration setting that can be used to adjust case sensitivity for the files you are working with. If you are using Git, you may want to adjust thegit config core.ignorecase setting.
To set Git to be case-sensitive (FOO.txt ≠ foo.txt), enter:
git config core.ignorecase false
To set Git to be case-insensitive (FOO.txt = foo.txt), enter:
git config core.ignorecase true
Setting this option to false on a case-insensitive file system may lead to confusing errors, false conflicts, or duplicate files.
For more information, see theGit Config documentation.
To use Windows file system tools to work on a Linux directory that contains mixed case files, you will need to create a brand new directory and set it to be case-sensitive, then copy the files into that directory (using git clone or untar). The files will remain mixed case. (Note that if you have already tried moving the files to a case-insensitive directory and there were conflicts, there were likely some files that were overwritten and will no longer be available.)
You cannot change the case sensitivity setting on a directory that contains other files or directories. Try creating a new directory, changing the setting, then copying your mixed-case files into it.
Ensure that you have the “Write attributes”, “Create files”, “Create folders” and “Delete subfolders and files” permissions on the directory required for changing case-sensitivity. To check these settings, open the directory in Windows File Explorer (from command line, use the command:explorer.exe .). Right-click the directory and selectProperties to open the Document Properties window, then selectEdit to view or change permissions for the directory.

The case sensitivity attribute can only be set on directories within an NTFS-formatted file system. Directories in the WSL (Linux) file system are case sensitive by default (and cannot be set to be case insensitive using the fsutil.exe tool).
Was this page helpful?
Need help with this topic?
Want to try using Ask Learn to clarify or guide you through this topic?
Was this page helpful?
Want to try using Ask Learn to clarify or guide you through this topic?