Here you can find the source of delete(File f)
Parameter | Description |
---|---|
f | a parameter |
public static boolean delete(File f)
//package com.java2s; import java.io.*; public class Main { /**//from w ww .j av a 2 s . c om * delete a file recursivly; * * @param path */ public static boolean delete(String path) { return delete(new File(path)); } /** * delete a file recursivly; * * @param f */ public static boolean delete(File f) { boolean deleted = false; if (f.exists()) { if (f.isFile()) { deleted = f.delete(); } else { File[] subs = f.listFiles(); if (subs != null && subs.length > 0) { for (int i = 0; i < subs.length; i++) { delete(subs[i]); } } deleted = f.delete(); } } return deleted; } }