Android examples for java.io:Directory
get File System Root For Path
import java.io.File; public class Main { static File getFSRootForPath(File path) { while (path != null && path.isDirectory()) { long fsSize = path.getTotalSpace(); File parent = path.getParentFile(); if (parent == null || parent.getTotalSpace() != fsSize) return path; path = parent;//from w ww . jav a2 s. c o m } return path; } }