Here you can find the source of deleteAllFiles(String folder, String type)
public static void deleteAllFiles(String folder, String type)
//package com.java2s; import java.io.File; public class Main { public static void deleteAllFiles(String folder, String type) { File src = new File(folder); String[] files = src.list(); for (String f : files) { if (new File(folder + File.separator + f).isDirectory()) { deleteAllFiles(folder + File.separator + f, type); } else if (f.endsWith(type)) { new File(folder + File.separator + f).delete(); }/* w w w . ja va 2 s .c o m*/ } } }