It's easy to write two files to an NTFS partition from Linux, and have both of those files contain the same letters but with different case, e.g. some_file.txt and Some_File.txt. Linux distinguishes them.

How does Windows handle these?

  • 1
    Personally, because of all the factors involved, I would just say that it causes undefined behavior. If Windows doesn't define the behavior in this case, then by definition, it's undefined. If Windows does define the behavior, I would still treat it as undefined behavior, because I seriously doubt that all programs handle this consistently.
    – jpfx1342
    May 24, 2014 at 21:45

2 Answers 2


The MS-DOS, WOW, and Win32 personalities will return the first matching file. For some applications and APIs, case-insensitivity is enforced (e.g., MS-DOS just can't deal with it). The POSIX personality will differentiate and is case sensitive by default (if you have the UNIX tools installed, for example). The native Windows NT command prompt will display both but, depending on settings (ObCaseInsensitive) and which APIs the tools use, only access the first one it finds.

See Microsoft Technet article Filenames are Case Sensitive on NTFS Volumes (KB100625) and also a detailed discussion of the subtleties of case sensitivity in the various NT subsystems: Understanding case sensitivity in Windows: obcaseinsensitive, FILE_CASE_SENSITIVE_SEARCH

In particular, the ObCaseInsensitive value controls the case sensitivity of the entire NT Object Manager:

HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\kernel\ dword:ObCaseInsensitive
  • When set to 0, the object manager runs in case sensitive mode.
  • When set to 1, the object manager runs in case insensitive mode.
  • When unspecified, NT 5.1 (Windows XP) and later editions default to running in case insensitive mode.
  • obcaseinsensitive has no meaning in NT 5.0 (Windows 2000) and prior versions of NT, which always run in case sensitive mode.

Cygwin should pick up the underlying/effective case-sensitivity settings at this point.

The related SuperUser question How to configure folder name case sensitivity in Windows 7? and TechNet article Configure Case Sensitivity for File and Folder Names have more information on enabling full case sensitivity for files and folders in NT if you will need to handle this situation regularly.

Additional resources on case-sensitive tooling/access to NTFS/NFS volumes:

  • If two files exist, One.txt and ONE.txt, which file would "match first" if I supply one.txt? Are there rules on which will be the "first matching file"?
    – trusktr
    May 24, 2014 at 20:53
  • 1
    It’s probably based on the internal file order in a directory. I’ll try it tomorrow, if you want to know exactly.
    – Daniel B
    May 24, 2014 at 21:38
  • 2
    Which one is first is purely decided by the order in which they appear in the directory. This is NOT necessarily the order in which they are created. And it may change if either file is modified or the directoy is updated. (Chkdsk, Defrag, deleting, copying moving other files in that folder can all change the order.)
    – Tonny
    May 25, 2014 at 15:06
  • 1
    @trusktr Well, apparently there is some kind of order, after all. I created multiple sets of files (using NTFS-3G), each with different capitalization and in different orders. Windows (or, more precisely, Notepad) always picks the file starting with an uppercase letter, regardless of creation order. more just returns a question mark, though.
    – Daniel B
    May 25, 2014 at 16:33
  • 1
    @trusktr It will follow the order of the INDX entries of the directory's B+ Tree. This tree is kept sorted by design, but may vary slightly depending on the NTFS driver. It will (OnCaseInsensitive=0, Win32/DOS/WOW API) be the first match while walking the (sorted) tree of the specified name and INDX entry name. NTFS uses ordinal comparisons, so uppercase should always be found before lowercase. (A-Z = 0041-005A, a-z = 0061-007A) May 25, 2014 at 22:13

It doesn't. It considers case differences but otherwise exact same names to be the same file.

You can test this by creating a file in all lowercase, then creating another with only one letter in upper and it will complain.

  • I don't have the environment to test that in right now. I only have OS X at the moment. Could you describe what happens? My first guess would be that Windows picks (perhaps inadvertently) which file to read/write by some criteria (e.g. lexical order with lower case taking precedence, or vice versa). Or does it not allow any file to be manipulated whatsoever?
    – trusktr
    May 24, 2014 at 19:27
  • 1
    @trusktr The system complains that the file already exists, depending on the application or code involved, this will silently be ignored and simply overwrite the preexisting file. As jpfx1342 commented, this issue should be treated as undefined behavior.
    – Casey
    May 25, 2014 at 1:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .