File differences between upper and lower case extensions

What is the difference between a file named file1.F and file1.f?
RHEL sees it was 2 files and windows sees it as the same file.

1 Comment

Answer from AI:
The difference comes down to how Linux (RHEL) and Windows handle case sensitivity in their file systems.
Case Sensitivity in Linux (RHEL)
  • Linux treats uppercase and lowercase letters as completely different characters
  • The file system (like ext4 or XFS) sees file1.F and file1.f as two distinct names.
  • You can store both files in the same directory at the same time without any conflicts. [1]
Case Insensitivity in Windows
  • Windows file systems (like NTFS or FAT32) are case-insensitive by default.
  • Windows treats uppercase and lowercase letters as the same character (F = f).
  • Windows views file1.F and file1.f as the exact same file name, so it will not allow them to exist in the same folder.

Sign in to comment.

Answers (1)

dpb
dpb about 1 hour ago
Edited: dpb 15 minutes ago
Yes, Windows is "case preserving but case insensitive" while *ix variants are both "case preserving AND case sensitive".
That means to RHEL, they look like and physically are two separate files whereas under Windows, the actual case of the file name is kept but the OS only pays attention to the case-insensitve search by keeping a hidden upper(filename) metadata table that maps any combination of matching names to the same actual physical file. It can be confusing, indeed, if one is used to the *ix behavior and move to Windows or vice versa.
It can get really bizarre if the two files both exist on *ix and copy them to a Windows platform -- the first to get copied will be the case-sensitive file name while the second will then overwrite the content so that one will have the content of the two reversed unless the copy mechanism flags that the second is going to overwrite to give a chance to not overwrite the first.
The real gotcha with the ".f" and ".F" extensions is that typically those would be Fortran/FORTRAN source files and compilers like gfortran trigger the Fortran preprocessor with the uppercase extension. Normally the preprocessor will not output a physical preprocessed file into the same directory but make a temporary preprocessed output file as the input for the compiler. I think the Intel OneAPI compiler does not trigger the preprocessor regardless of the case of the extension by default on Windows.
If you do have both, you'll need to ensure to avoid the overwriting issue if moving to the Windows environment.

Tags

Asked:

about 8 hours ago

Edited:

dpb
about 7 hours ago

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!