天天看点

Get sdcard directory by adb

解决方案: 

adb shell echo $EXTERNAL_STORAGE 

I am making an application, which pulls files(Saved by android app) from the device sdcard by adb. The problem is that different devices, have various sdcard directories

i.e:

  • sdcard
  • sdcard/external_sd
Firstly I invented following solution:
  1. run adb shell
  2. ls
  3. Check if dir "sdcard" exists
  4. If yes run sdcard/ ls and check if external_sd exists
  5. return value.
But the problem is that I have two samsung devices 

GT-I9100

 and 

GT-I9000

 and both have a directory 

sdcard/external_sd

. When I am checking 

System.getenv("EXTERNAL_STORAGE")

 one returns 

sdcard

 and another 

sdcard/external_sd

. I need to pull file which was previously saved to

System.getenv("EXTERNAL_STORAGE")

.

EDIT: Found the solution:

adb shell echo $EXTERNAL_STORAGE           

原文连接:http://stackoverflow.com/questions/9374628/get-sdcard-directory-by-adb 

返回导读目录,阅读更多随笔

分割线,以下为博客签名:

软件臭虫情未了

  • 编码一分钟
  • 测试十年功

随笔如有错误或不恰当之处、为希望不误导他人,望大侠们给予批评指正。