Java tutorial
//package com.java2s; import java.io.File; public class Main { public static boolean deleteFiles(String path) { File file = new File(path); boolean flag = false; if (file == null) { return flag; } if (file.isFile()) { file.delete(); } else if (file.isDirectory()) { File[] fileList = file.listFiles(); for (int i = 0; i < fileList.length; i++) { flag = deleteFiles(fileList[i].getAbsolutePath()); // if(!flag){ // break; // } } } return flag; } }