Java tutorial
//package com.java2s; import java.io.File; public class Main { public static void deleteFile2(File file) { // Log.i(TAG, "delete file path=" + file.getAbsolutePath()); if (file.exists()) { if (file.isFile()) { file.delete(); } else if (file.isDirectory()) { File files[] = file.listFiles(); for (int i = 0; i < files.length; i++) { deleteFile2(files[i]); } } file.delete(); } else { // Log.e(TAG, "delete file no exists " + file.getAbsolutePath()); } } }