Keeping uppercase and lowercase named files in the same folder?

Original Post:

UKSBD

Moderator
  • Dec 30, 2005
    13,034
    1
    2,835
    On website I have 2 images both named the same but one in uppercase other in lower case

    ie.

    /img/Test.jpg and /img/test.jpg

    Both display fine on the website but if I try to store them both in a folder on my desktop one overrides the other.

    Is there a way I can change the folder so both test.jpg and Test.jpg can both be in the same folder?
     
    • Like
    Reactions: estwig
    This is possible, but only if the drive or partition is formatted as NTFS. If it's not you could make a new NTFS partition just for this.
    The command is
    fsutil.exe file SetCaseSensitiveInfo #:\Path\To\Directory\Here enable
     
    Upvote 0

    UKSBD

    Moderator
  • Dec 30, 2005
    13,034
    1
    2,835
    This is possible, but only if the drive or partition is formatted as NTFS. If it's not you could make a new NTFS partition just for this.
    The command is
    fsutil.exe file SetCaseSensitiveInfo #:\Path\To\Directory\Here enable

    Thanks

    Yeah, I did a bit of looking around.

    Looks like too much trouble just for the sake of a couple of images.

    I'll just store them in separate folders if I ever find any more where it happens again
     
    Upvote 0
    Fair enough.

    I tried it out anyway, and these are the required steps - using folder D:\Temp\Test
    Note: NTFS isn't required.

    1. Run in Admin - Power Shell. Restart when prompted
    Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
    2. Run in Admin - Command Prompt
    fsutil.exe file SetCaseSensitiveInfo D:\Temp\Test enable

    Once complete works fine, and I'm able to make multiple files with same name, but different case.
     
    • Like
    Reactions: UKSBD
    Upvote 0

    Nico Albrecht

    Free Member
    Business Listing
    May 2, 2017
    1,622
    473
    Belfast
    data-forensics.co.uk
    If your web server uses Linux and you download files to a Windows NTFS file system, you may encounter errors due to the differences in how these file systems treat files, folders, and directories.



    To put it simply, the default Linux file system can be messy and chaotic compared to NTFS, which is more structured and elegant. NTFS makes more technical sense as it does not work with case sensitivity in a file system. There are reason why but I wanna keep this simple.



    When working with both Linux and Windows files and directories, it is important to understand the differences in case sensitivity handling.


    By default, the Windows file system treats file and directory names as case-insensitive, meaning that /img/Test.jpg and img/test.jpg are treated as equivalent files. While it is possible to set flags in NTFS to enable case sensitivity, it is generally not recommended unless absolutely necessary.


    In contrast, the Linux file system treats file and directory names as case-sensitive, so FOO.txt and foo.txt are considered to be distinct files.


    While the Windows file system does support setting case sensitivity with attribute flags per directory, it is usually more efficient to simply rename the files and organize them in a better folder structure and naming convention, rather than creating flags in NTFS to work with a file system that can seem chaotic and difficult to work with at times.

    Linux default file system is a big mess and plenty of things it inherited haven't been properly fixed yet either. Ex4 is wild at best.

    My advise is do not set flags in NTFS to work with it and restructure your file and folder naming.
     
    Upvote 0

    UKSBD

    Moderator
  • Dec 30, 2005
    13,034
    1
    2,835
    In contrast, the Linux file system treats file and directory names as case-sensitive, so FOO.txt and foo.txt are considered to be distinct files.

    Is there a default setting?

    for instance

    If I have a directory on the website called /img/ with test.jpg and Test.jpg in it, and then transfer these 2 images to a folder on my desktop called /img/ would test.jpg or Test.jpg be added to the folder?
     
    Upvote 0

    UKSBD

    Moderator
  • Dec 30, 2005
    13,034
    1
    2,835
    I've just been testing

    Makes you realise how important it is never to use uppercase in images

    If I have test.jpg and Test.jpg on the server in this order

    test.jpg
    Test.jpg

    Then drag them both in to an empty folder on desktop

    only the file test.jpg is transferred but it's actually the image Test.jpg

    I then have to drag test.jpg from server to desktop to correct it.

    But if I then drag Test.jpg from the server, the filename on my desktop doesn't change (remains test.jpg) but the image does change
     
    Upvote 0

    Nico Albrecht

    Free Member
    Business Listing
    May 2, 2017
    1,622
    473
    Belfast
    data-forensics.co.uk
    Is there a default setting?
    The issue at hand is unrelated to settings within your operating system and instead depends on the underlying file system in use. By default, Windows utilizes the NTFS file system, which only permits lowercase characters, while Linux allows for uppercase characters in its file system. Conversely, your webhosting employs the ext4 file system, whereas you have downloaded onto an NTFS file system, which only accepts lowercase characters.

    The CMD commands specified in the text would add a flag to your files, thereby enabling the file system to accept them, but it may have undesirable effects.

    As the operating system resides above the file system layer, there is no option to toggle for this matter, and any adjustments must be made at the file system level. This is not a flaw in the system's design but rather a deliberate choice based on specific reasons.

    It is similar to how an email address with uppercase letters will always be perceived as lowercase by any email server.

    Remember that a file system is not essential for a computer to operate, but it is necessary for us humans to understand and manipulate data since we cannot work with sectors, blocks, and clusters as machines do. Therefore, file systems are used to present data in a more comprehensible way.

    Cross-OS file sharing can be entertaining with Samba/SMB, but it is best to adhere to lowercase characters, concise names, and refrain from utilizing special characters in file and folder names if you intend to share them with different file systems.
     
    Upvote 0

    Latest Articles