Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

File paths in Windows environment not case sensitive?

Tags:

windows

Is it safe to assume that Windows local and network file paths are NOT case sensitive?

like image 341
burnt1ce Avatar asked Aug 26 '11 01:08

burnt1ce


People also ask

Are Windows file paths case-sensitive?

Windows file system treats file and directory names as case-insensitive.

How do I make Windows file system case-sensitive?

Type the following command to enable NTFS to treat the folder's content as case sensitive and press Enter: fsutil.exe file SetCaseSensitiveInfo C:\folder\path enable In the command, remember to include the path to the folder you want to enable case sensitivity.

When working with a Windows 10 PC which of the following are case-sensitive?

Windows 10 now offers an optional case-sensitive file system, just like Linux and other UNIX-like operating systems. All Windows processes will handle case-sensitive files and folders properly if you enable this feature. In other words, they'll see “file” and “File” as two separate files.

Are UNC paths case-sensitive?

Note that the UNC path is not case-sensitive. A UNC path makes it easy to navigate the network, particularly when you know the path name already.


2 Answers

Yes. Windows (local) file systems, including NTFS, as well as FAT and variants, are case insensitive (normally). The underlying implementation of a network file system may be case sensitive, however, most software that allows Windows to access it (such as SMB) will automatically make case sensitive file systems appear as case insensitive to Windows.

For details, I'd read the section in the Wikipedia article on filenames.

like image 94
Reed Copsey Avatar answered Sep 19 '22 13:09

Reed Copsey


Case sensitivity on Windows is actually implemented in how the application opens the files. NTFS can be a case-sensitive file system and can happily store files, with identical names differing only by case in the same directory.

On Windows all files are ultimately opened via the CreateFile API - If the FILE_FLAG_POSIX_SEMANTICS flag is passed to the call (and the file system being accessed is natively case-sensitive) then the file will be opened based on an exact name match. If FILE_FLAG_POSIX_SEMANTICS is not passed then the filesystem does a case-insensitive file open and will open one of the files with a matching name. If there is more than one it's undefined as to which one is actually opened.

Most C and C++ runtime implementations on Windows do not provide any access to this mechanism and never use this flag so the only way to get access to case-sensitive behaviors is to use the Windows API directly.

tl;dr - Your language runtime probably exposes your filesystem as case insensitive or case preserving. You can, if you use the windows API directly, access supported filesystems fully case senstive.

like image 30
Chris Becke Avatar answered Sep 21 '22 13:09

Chris Becke