Here you can find the source of delete(File file)
Parameter | Description |
---|---|
file | The file or dir to remove |
public static boolean delete(File file)
//package com.java2s; //License from project: Apache License import java.io.File; public class Main { /**/* w w w . ja v a2s .com*/ * Deletes recursively the given file (if it is a directory) * or just removes itself * * @param file The file or dir to remove * * @return True if the deletion was successful */ public static boolean delete(File file) { if (file.isDirectory()) { File[] contents = file.listFiles(); if (null != contents) { for (File child : contents) { delete(child); } } file.delete(); return true; } else { return file.delete(); } } }