Here you can find the source of delete(File file)
Parameter | Description |
---|---|
file | The file to delete |
public static void delete(File file)
//package com.java2s; import java.io.File; public class Main { /**//w w w.j a va2 s . com * Delete the specified file, recursively as necessary. * * @param file The file to delete */ public static void delete(File file) { if (file.exists()) { if (file.isDirectory()) { File[] files = file.listFiles(); for (int i = 0; i < files.length; i++) { delete(files[i]); } } file.delete(); } } /** * Delete the specified file, recursively as necessary. * * @param fileName The file to delete */ public static void delete(String fileName) { delete(new File(fileName)); } }