Here you can find the source of delTree(File file)
Parameter | Description |
---|---|
file | the directory to delete |
public static void delTree(File file)
//package com.java2s; /*//from ww w .j av a 2 s. c o m * Copyright (c) 2008-2011 by Bjoern Kolbeck, Jan Stender, * Felix Langner, Zuse Institute Berlin * * Licensed under the BSD License, see LICENSE file for details. * */ import java.io.File; public class Main { /** * Recursively deletes all contents of the given directory. * * @param file * the directory to delete */ public static void delTree(File file) { if (!file.exists()) return; File[] fileList; if ((fileList = file.listFiles()) != null) { for (File f : fileList) { if (f.isDirectory()) delTree(f); else f.delete(); } } file.delete(); } }