Android examples for java.io:File Delete
delete Folder Contents recursively
import java.io.File; public class Main { public static boolean deleteContents(File dir) { File[] files = dir.listFiles(); boolean success = true; if (files != null) { for (File file : files) { if (file.isDirectory()) { success &= deleteContents(file); }/*from ww w . ja v a 2 s. com*/ if (!file.delete()) { success = false; } } } return success; } }