// Clears folder from the mess we make public static void clearFolder(String strFolder, String strExt) { // Declare variables File fLogDir = new File(strFolder); // Get all BCS files File[] fLogs = fLogDir.listFiles(new FilenameFilter() { public boolean accept(File fDir, String strName) { return (strName.endsWith("." + strExt)); } }); // Delete all files for (int i = 0; i < fLogs.length; i++) { deleteFile(fLogs[i].getAbsolutePath()); } }