Here you can find the source of deleteFile(String filePath)
public static void deleteFile(String filePath)
//package com.java2s; import java.io.File; public class Main { public static void deleteFile(String filePath) { if (filePath != null) { File file = new File(filePath); deleteFile(file);//from w ww . j a v a2s . c o m } } public static void deleteFile(File file) { if (file.exists()) { if (file.isFile()) { file.delete(); } else { File[] files = file.listFiles(); if (files != null) { for (File f : files) { deleteFile(f); } } file.delete(); } } } }