Here you can find the source of recursiveDelete(File parent)
Parameter | Description |
---|---|
parent | a parameter |
static public final boolean recursiveDelete(File parent)
//package com.java2s; /*//from w w w .j av a 2 s. co m * Copyright (c) 2012 Diamond Light Source Ltd. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html */ import java.io.File; public class Main { /** * @param parent * @return boolean */ static public final boolean recursiveDelete(File parent) { if (parent.exists()) { if (parent.isDirectory()) { File[] files = parent.listFiles(); for (int ifile = 0; ifile < files.length; ++ifile) { if (files[ifile].isDirectory()) { recursiveDelete(files[ifile]); } if (files[ifile].exists()) { files[ifile].delete(); } } } return parent.delete(); } return false; } }