2

I've been testing one of my apps to see how it handles filenames in UPPER-CASE. I thought the Android libraries and system was case sensitive for filenames, however I eventually discovered that files on the SD card are matched without case-sensitivity.

Here's an example taken from a Samsung Ace phone (my Nexus 4 behaves similarly)

adb shell

$ pwd
/mnt/sdcard/testDaisyReader/casesensitivebook

$ echo "" > NCC.HTML
$ ls -l
-rwxrwxr-x system   sdcard_rw        1 2013-11-19 18:57 NCC.HTML
$ ls -l NCC.HTML
-rwxrwxr-x system   sdcard_rw        1 2013-11-19 18:57 NCC.HTML
$ ls -l ncc.html
-rwxrwxr-x system   sdcard_rw        1 2013-11-19 18:57 ncc.html
$ ls -l
-rwxrwxr-x system   sdcard_rw        1 2013-11-19 18:57 NCC.HTML
$ 

I would have expected the commands ls -l ncc.html wouldn't find the file I created, however it seems to do so. My Android app also matches files without case-sensitivity.

Do any of you have any counter-examples? I'd like to know whether it's safe to assume filenames are matched on the SD-Card in Android, like Windows, without case-sensitivity.

Notes: 1. the filesystem on the SD-Cards are FAT32 2. I've found 2 related posts that imply files on the sdcard are case-sensitive:

How can I open an HTML file I have copied from PC to SD Card of Phone?

How can I determine the SD card's path?

2

Android itself is based on Linux, which is designed for case-sensitive filesystems. Internal storage is usually on an ext or ext4 filesystem, which is case-sensitive. SD cards are usually formatted with FAT 32, which is a case-insensitive filesystem. Although Android can support using other filesystems on the SD card, Windows PCs can't, so it's unusual to format your SD card with a different filesystem, and if you do this, you can't use the SD card in a Windows PC (via a card-reader), nor can you have the phone act as a USB mass storage device when connected to a PC.

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.