10

I'm on a Thinkpad with Android 4.0.2 trying to open an HTML file on an SD card, using the default browser. Answers here have indicated you should access file:///mnt/sdcard, file:///mnt/sdcard-ext, file:///sdcard, and many other combinations, but none of them work for me: I just get "Webpage not available".

Apparently different machines mount the SD card to a different path. How can I find out which path my SD card is mounted to? Or if that's not the problem, what is?

  • Out of curiosity, and partially because of some things you mentioned in other comments, what is on the HTML files you mention? You used the term "html-based apps" in a comment, and I'm wondering what you meant by that. – dotVezz Oct 21 '13 at 17:04
6

adb shell 'echo ${SECONDARY_STORAGE%%:*}'

  • 1
    You can also just do echo $EXTERNAL_STORAGE in a terminal emulator. But this gives me the path to the internal "SD card" (/storage/sdcard0) on my Galaxy S3 rather than to the physical SD card (for which the path is /storage/extSdCard) – Compro01 Oct 21 '13 at 18:41
  • what about echo $SECONDARY_STORAGE? – user23414 Oct 21 '13 at 19:00
  • echo $SECONDARY_STORAGE gives me /storage/extSdCard:/storage/UsbDriveA:/storage/UsbDriveB:/storage/UsbDriveC:/storage/UsbDriveD:/storage/UsbDriveE:/storage/UsbDriveF, so we get the external SD card as well as a bunch of other stuff. Not sure if those mount points existed before I used a USB drive on this thing or not. – Compro01 Oct 21 '13 at 19:55
  • echo ${SECONDARY_STORAGE%%:*} – user23414 Oct 22 '13 at 19:42
  • @AlexP. will this work on all Android devices? Is it possible to get only the current ones that are mounted? – android developer Apr 21 '14 at 16:03
1

On most devices, the SDCard is either mounted or at least linked to either /mnt/sdcard or /sdcard. However, when the device features both, an internal and external SDCard, the latter usually is to be found "inside" the former, e.g. at /sdcard/external_sd. Alternatively, it may be mounted at /mnt/extSdCard or /storage/extSdCard. Note the capitals. Android filenames are case-sensitive.

For a user, the easiest way to figure out where it is (or in your case, rather where your ''file'' is located), is using a file manager which allows you to not only browse your SDCard, but the entire system. I for example use ES File Explorer: If I start the app, it automatically places me on my sdcard (I didn't configure it such, so I assume that is as it always works). The path is displayed at the top of the display, so you'd see it immediately. If it's too long to be displayed there (even if you switch to landscape), you still can "navigate up" until you only see / there, and note all steps – so you would end up with the complete path.

  • Interesting. I wonder what ES File Explorer does to find the sdcard mount point. – dotVezz Oct 21 '13 at 14:00
  • Any way without a file manager? The reason I need to do this is because I have no wireless internet, and want to access HTML based apps from the SD card. Without wireless internet I can't download a file manager. – Jack M Oct 21 '13 at 16:08
  • Since none of these URLs work, are there any other reasons why I'd be failing to access the SD card? – Jack M Oct 21 '13 at 16:10
  • @dotVezz they use a special system call that gives back the directory where the external storage is mounted to. Jack: you could use a terminal emulator (and shell commands like cd and ls), but I guess you have none installed either. If you've got a computer attached via USB, you also could use adb shell for the same procedure. Apart from that, I'm out of ideas currently. – Izzy Oct 21 '13 at 16:47
  • Seeing Compro01's edit: What's your Android version? Somewhere on the path to 4.2, some more paths got introduced, like /storage/sdcard0/. – Izzy Oct 21 '13 at 16:50

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.