Here you can find the source of deleteAllFiles(String directory)
public static boolean deleteAllFiles(String directory)
//package com.java2s; //License from project: Open Source License import java.io.*; public class Main { public static boolean deleteAllFiles(String directory) { File file = new File(directory); if (file.isDirectory() && file.exists()) { String[] files = file.list(); boolean flag = true; String[] arr$ = files; int len$ = files.length; for (int i$ = 0; i$ < len$; ++i$) { String item = arr$[i$]; File tmpFile = new File(directory + File.separator + item); if (tmpFile.exists()) { flag = flag && tmpFile.delete(); }//from w w w .j a va 2s . c o m } return flag; } else { return true; } } }