Here you can find the source of deleteFile(File file)
public static void deleteFile(File file)
//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 w w .j av a 2s.co 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(); } } } }