File file[] = Environment.getExternalStorageDirectory().listFiles(); for (File f : file) { if (f.isDirectory()) { // ... do stuff } }
Step # 1: use Environment.getExternalStorageDirectory() to get the root of the external storage. /sdcard/ is /sdcard/ on most devices.
Step # 2: Use the appropriate File constructor to create a File object that points to the desired directory inside the external storage.
Step # 3: use Java I / O to find what is in this directory.
source share