11

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 Johnson Feb 24 '15 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 '15 at 19:31
  • Look up ObCaseInsensitive and superuser.com/q/266110/59271 – user541686 Feb 24 '15 at 19:34
  • @grawity isn't that just a case of tomayto, tomahto? – wvdz Feb 24 '15 at 22:43
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:

9
  • 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 '15 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 – Furkan Omay Feb 24 '15 at 13:34
  • 1
    @FurkanOmay I see, good old unix subsystem, thanks for that. – MDMoore313 Feb 24 '15 at 13:35
  • 1
    @FurkanOmay I knew what you meant ;) – MDMoore313 Feb 24 '15 at 13:38
  • @BigHomie Answer updated to explain how to enable posix – DavidPostill Feb 24 '15 at 13:42
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 '15 at 19:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.