Here you can find the source of deleteDir(File dir)
Parameter | Description |
---|---|
dir | a parameter |
public static void deleteDir(File dir)
//package com.java2s; /**//from w w w . j ava 2 s . com * WSIT Build Tools (http://aikidojohn.github.com/wsitbt/) * * Copyright (c) 2011 Application Security, Inc. * * 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 * * Contributors: * Application Security, Inc. */ import java.io.File; public class Main { /** * Deletes the specified directory and any files it and directories contains. * @param dir */ public static void deleteDir(File dir) { for (String filename : dir.list()) { File file = new File(dir.getAbsolutePath() + "/" + filename); if (file.isDirectory()) { deleteDir(file); } else { file.delete(); } } dir.delete(); } }