Here you can find the source of deleteRecursive(final File file)
Parameter | Description |
---|---|
file | file to be deleted |
public static boolean deleteRecursive(final File file)
//package com.java2s; //License from project: Open Source License import java.io.File; public class Main { /**// www .jav a 2 s. c om * Deletes a file or directory. * If the file is a directory it recursively deletes it. * @param file file to be deleted * @return true if all the files where deleted successfully. */ public static boolean deleteRecursive(final File file) { boolean result = true; if (file.isDirectory()) { for (final File inner : file.listFiles()) { result &= deleteRecursive(inner); } } return result & file.delete(); } }