Here you can find the source of delTree(File root)
Parameter | Description |
---|---|
root | the directory tree to delete |
public static void delTree(File root)
//package com.java2s; // (as allowed under the Apache License 2.0) import java.io.File; public class Main { /**//ww w . j av a 2s. c o m * Delete an entire tree with files, subdirectories, etc. * * CAREFUL, DANGEROUS! * * @param root * the directory tree to delete */ public static void delTree(File root) { if (!root.isDirectory()) throw new IllegalArgumentException("Not a directory: " + root); for (File f : root.listFiles()) { if (f.isDirectory()) delTree(f); else f.delete(); } root.delete(); } }