12

In linux you can have the files example.JPG and example.jpg in the same directory.

In Windows you have case sensitive extensions, but you can't put these two files in the same directory. Why not?

4
  • 1
    possible duplicate of Are all versions of Windows case insensitive? (there's probably a better question than that)
    – Cole Tobin
    Feb 24, 2015 at 15:03
  • FAT held the extension separate from the base name, and the OS added the . for input and display purposes. (I believe it's safe to say that practically nobody uses FAT for anything except interoperability these days.) I don't know exactly how NTFS does it, but I suppose it's similar to every major Linux file system, which simply treats the file name as a string of characters. There is nothing special there about the file extension: it is simply by convention, and is treated by the file system as a part of the file name.
    – user
    Feb 24, 2015 at 19:31
  • Look up ObCaseInsensitive and superuser.com/q/266110/59271
    – user541686
    Feb 24, 2015 at 19:34
  • @grawity isn't that just a case of tomayto, tomahto?
    – wvdz
    Feb 24, 2015 at 22:43

2 Answers 2

32

In Windows you have case sensitive extensions, but you can't put these two files in the same directory. Why not?

If a drive is formatted as NTFS you can have both example.JPG and example.jpg.

However, if you attempt to open one of these files in a Win32 application, such as Notepad, you would only have access to one of the files, regardless of the case of the filename you type in the Open File dialog box.


Filenames are Case Sensitive on NTFS Volumes

As part of the requirements for POSIX compliance, the Windows NT File System (NTFS) provides a case-sensitive file and directory naming convention. Even though NTFS and the POSIX subsystem each handle case-sensitivity well, 16-bit Windows-based, MS-DOS-based, OS/2-based, and Win32-based applications do not.

In NTFS, you can create unique file names, stored in the same directory, that differ only in case. For example, the following filenames can coexist in one directory on an NTFS volume:

CASE.TXT
case.txt
case.TXT

However, if you attempt to open one of these files in a Win32 application, such as Notepad, you would only have access to one of the files, regardless of the case of the filename you type in the Open File dialog box.

...

NTFS supports two slightly different modes of operation that can be selected by the subsystem of the application interacting with NTFS. The first is fully case sensitive and demands that file names supplied by the application match the names stored on disk including case if the file on disk is to be selected. The second mode of operation is case preserving but not case sensitive. This means that applications can select files on the disk even if the supplied name differs in case from the name stored on the disk. Note that both modes preserve the case used to create the files. The difference in behavior noted here applies only when an application needs to locate an existing file. POSIX takes advantage of the full case sensitive mode, while MS-DOS, WOW, and Win32 subsystems use the case insensitive mode.

Source Filenames are Case Sensitive on NTFS Volumes:


In practice, I wasn't able to accomplish this

To achieve two files in the same directory differing only by case you need to enable the Posix subsystem.

POSIX takes advantage of the full case sensitive mode, while MS-DOS, WOW, and Win32 subsystems use the case insensitive mode.

To enable Posix see:

6
  • This is news to me. I had to downvote this temporarily though because even though you have citations, in practice, I wasn't able to accomplish this. Would you mind providing instructions on how this can be accomplished in practice?
    – MDMoore313
    Feb 24, 2015 at 13:26
  • 7
    @BigHomie That is Windows shell, which is preventing you. NTFS can hold a.JPG and a.jpg in the same directory. If you enable Unix Subsystem (deprecated), file names will be case sensitive in Windows Explorer Shell too. technet.microsoft.com/en-us/library/cc771470.aspx Feb 24, 2015 at 13:34
  • "dodge Windows and you can do it" slightly avoids the question "why doesn't Windows do it?". Windows 9x came via DOS and the FAT filesystem which only used uppercase, no matter what you typed ( en.wikipedia.org/wiki/Filename#Letter_case_preservation ). Recent Windows come from NT, and part of NTFS design was to get away from the 8.3 file-name limits in early FAT (says Wikipedia). So why did win32 keep this behaviour by default?. Win 95 Explorer was ported to NT 4: technet.microsoft.com/en-us/magazine/… is that why? Backwards compat. with Win16? Feb 25, 2015 at 1:25
  • @TessellatingHeckler where does "dodge Windows and you can do it" come from? I don't see that quote in any of the comments?
    – DavidPostill
    Feb 25, 2015 at 12:23
  • @DavidPostill It's not a literal quote, it's a paraphrasing because comment space is small. Yes, POSIX subsytem + Windows kernel + NTFS falls under the "Windows" umbrella, but whatever you do, win32 can't handle it. I'm suggesting that "if you exclude all the Windows software you've ever heard of, it can" is answering literally on a technicality and not getting to the spirit of the question (which I read as "Why was the everyday Windows end user experience designed not to be able to do this?"). Feb 26, 2015 at 7:12
6

NTFS is Case Sensitive (& depending on how you view the glass , it might be a good thing or a bad thing). In reality, achieving Case Insensitivity was a challenge in the early days since you had to NOT differentiate between ASCII values for a-z & A-Z .

There is no way to make Windows (the OS) case sensitive even though NTFS (the File System) used by Windows OS's these days can support in order to comply with POSIX.

According to Microsoft you could have example.JPG and example.jpg in the same directory on NTFS (click here), but the OS (All Versions of Windows) does not support it which makes the fact the File System can pointless :)

As part of the requirements for POSIX compliance, the Windows NT File System (NTFS) provides a case-sensitive file and directory naming convention. Even though NTFS and the POSIX subsystem each handle case-sensitivity well, 16-bit Windows-based, MS-DOS-based, OS/2-based, and Win32-based applications do not.

1
  • 1
    Case insensitivity isn't so hard, especially in encodings like ASCII. DOS did it, CP/M did it. Case insensitivity along with case preservation is the harder nut to crack. Certainly not hard to do, but harder to do in a consistent manner when you might be lucky to have 16-32 KB of RAM to play with and that needs to hold an application doing actually useful stuff too.
    – user
    Feb 24, 2015 at 19:28

You must log in to answer this question.

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