Here you can find the source of deleteFilesInDirectory(File path)
public static void deleteFilesInDirectory(File path)
//package com.java2s; //License from project: Open Source License import java.io.File; public class Main { public static void deleteFilesInDirectory(File path) { if (path.exists()) { File[] files = path.listFiles(); for (int i = 0; i < files.length; i++) { if (!files[i].isDirectory()) { files[i].delete();//from w w w. j a v a 2s . c om } } } } }