删除文件用
File. delete()
// 以下代码来自CSDN
         /*
 * 删除一个目录下的所有文件
 */   
public static void delAllFile(String path) {
File file = new File(path);
if(!file.exists()) return;
if(!file.isDirectory()) return;
String[] tempList = file.list();
File temp = null;
for(int i = 0; i < tempList.length; i++) {
if(path.endsWith(File.separator))
temp = new File(path + tempList[i]);
else 
temp = new File(path + File.separator + tempList[i]);
if(temp.isFile()) temp.delete();
if(temp.isDirectory()) delAllFile(path + tempList[i]);
}
}