How to Enable or Disable Case Sensitive Attribute for Folders in Windows 10


If you have used the Windows Subsystem for Linux, you’re probably aware that it allows you to treat your Windows file systems (mounted under /mnt/c, /mnt/d, etc.) as case sensitive. This means, among other things, that you can create files whose names differ only by case (e.g. foo.txt and FOO.TXT).

However, using those files in Windows was not really possible. Since Windows applications treat the file system as case insensitive, they cannot distinguish between files whose names only differ in case. While File Explorer would show both files, only one would be opened regardless of which one you clicked.

Starting with Windows 10 build 17093, Microsoft introduced a new way to handle case sensitive files in Windows: per-directory case sensitivity. Microsoft uses this ability in the Windows Subsystem for Linux to give you better interoperability when using case sensitive files, and you can also use it yourself with regular Windows applications. As of Windows 10 build 17110, this behavior is the default.

Case sensitivity in Windows
The Windows NT family of operating systems (including Windows 10) has always had the ability to perform case sensitive file system operations. Applications can pass the FILE_FLAG_POSIX_SEMANTICS flag to the CreateFile API to indicate that they want the path to be treated as case sensitive. However, for compatibility reasons, there is a global registry key that overrides this behavior; when this key is set, all file operations are case insensitive, even when the FILE_FLAG_POSIX_SEMANTICS flag is specified. Since Windows XP, this has been the default.

The Windows Subsystem for Linux uses another mechanism, which itself bypasses that registry key, allowing us to perform case sensitive file system operations. This is what allows Linux applications running in WSL to use file names that differ only by case, just like they can on real Linux, even with that global registry key set.

Unfortunately, this leaves you with files that can’t be accessed by Windows applications. While you could change the global registry key, that still would only work for those applications that use FILE_FLAG_POSIX_SEMANTICS, and this would change the behavior for all files on all drives, which may not be intended and may break some applications.

Per-directory case sensitivity
To solve this problem, Microsoft added a new case sensitive flag (attribute) that can be applied to NTFS directories (folders). For directories that have this flag set (enabled), all operations on files in that directory are case sensitive, regardless of whether FILE_FLAG_POSIX_SEMANTICS was specified. This means that if you have two files that differ only by case in a directory marked as case sensitive, all applications will be able to access them.

Starting with Windows 10 build 17107, Microsoft has added the ability to view and modify this flag to the fsutil.exe command.

Note that 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. Changing the flag requires “write attributes” permission to the directory.

This tutorial will show you how to enable or disable the case sensitive attribute on a per-folder basis which includes all files in the folder in Windows 10.


 CONTENTS:

  • Option One: To Query Case Sensitive Attribute of a Folder
  • Option Two: To Enable Case Sensitive Attribute of a Folder
  • Option Three: To Disable Case Sensitive Attribute of a Folder


EXAMPLE: Per-directory case sensitivity








Enable or Disable Case Sensitive Attribute for Folders in Windows 10 OPTION ONE Enable or Disable Case Sensitive Attribute for Folders in Windows 10
To Query Case Sensitive Attribute of a Folder

1. Open a command prompt or elevated command prompt based on your access permissions for the folder.

2. Type the command below into the command prompt and press Enter. (see screenshot below)

fsutil.exe file queryCaseSensitiveInfo "full path of folder"

For example: fsutil.exe file queryCaseSensitiveInfo "C:\Users\Brink\Desktop\New folder"

If you wanted to query the case sensitive attribute of files only in the root directory of a drive , then you would enter only the drive letter (ex: "E:").

For example: fsutil.exe file queryCaseSensitiveInfo "E:"

3. You will now see if the case sensitive attribute for this directory is currently enabled or disabled. You can now close the command prompt if you like.

Name:  query_case_sensitivity_attribute_of_directory.png
Views: 1469
Size:  20.5 KB






Enable or Disable Case Sensitive Attribute for Folders in Windows 10 OPTION TWO Enable or Disable Case Sensitive Attribute for Folders in Windows 10
To Enable Case Sensitive Attribute of a Folder

1. Open a command prompt or elevated command prompt based on your access permissions for the folder.

2. Type the command below into the command prompt and press Enter. (see screenshot below)

fsutil.exe file setCaseSensitiveInfo "full path of folder" enable

For example: fsutil.exe file setCaseSensitiveInfo "C:\Users\Brink\Desktop\New folder" enable

If you wanted to enable the case sensitive attribute of files only in the root directory of a drive, then you would enter only the drive letter (ex: "E:").

For example: fsutil.exe file setCaseSensitiveInfo "E:" enable

3. The case sensitive attribute for this directory (and all files in it) is now enabled. You can now close the command prompt if you like.

Name:  enable_case_sensitivity_attribute_of_directory.jpg
Views: 1465
Size:  31.5 KB






Enable or Disable Case Sensitive Attribute for Folders in Windows 10 OPTION THREE Enable or Disable Case Sensitive Attribute for Folders in Windows 10
To Disable Case Sensitive Attribute of a Folder

1. Open a command prompt or elevated command prompt based on your access permissions for the folder.

2. Type the command below into the command prompt and press Enter. (see screenshot below)

fsutil.exe file setCaseSensitiveInfo "full path of folder" disaable

For example: fsutil.exe file setCaseSensitiveInfo "C:\Users\Brink\Desktop\New folder" disable

If you wanted to disable the case sensitive attribute of files only in the root directory of a drive, then you would enter only the drive letter (ex: "E:").

For example: fsutil.exe file setCaseSensitiveInfo "E:" disable

3. The case sensitive attribute for this directory (and all files in it) is now disabled. You can now close the command prompt if you like.

Name:  Disable_case_sensitivity_attribute_of_directory.jpg
Views: 1459
Size:  32.6 KB


That's it,
Shawn