Enabling Case Sensitivity in Windows

I recently needed to download a large number of files from a Linux server using SCP, which would take nearly 12 hours. When i checked the next day this transfer had stopped to ask if I wanted to overwrite a file. This was because two files had the same name, differing only in case.

I remembered there was a registry setting that could set the NTFS filesystem to be case sensitive[0], but I’d rather not do that on this workstation. I did a Google search anyway, but then I found there is a newer way to do this which is on a per-folder basis instead of globally[1].

There is a command called “fsutil.exe” that can adjust a lot of filesystem settings, one of them is “SetCaseSensitiveInfo”, which controls if the folder is case sensitive or not.

fsutil.exe file SetCaseSensitiveInfo C:\folder enable

When I restarted the download, it still didn’t work, because that command only applies it to the specified folder, and any new folders created after. It does not apply to existing sub-folders. The following PowerShell command will apply the setting to any existing folder.

Get-ChildItem C:\folder -Recurse | 
	? {$_.PSIsContainer} |
	% { fsutil.exe file SetCaseSensitiveInfo $_.FullName enable }

References

[0] https://superuser.com/questions/266110/how-do-you-make-windows-7-fully-case-sensitive-with-respect-to-the-filesystem

[1] https://docs.microsoft.com/en-us/windows/wsl/case-sensitivity