Java Utililty Methods Delete Tree

List of utility methods to do Delete Tree

Description

The list of methods to do Delete Tree are organized into topic(s).

Method

voiddeltree(String dir)
Deletes the directory and its content.
String sep = System.getProperty("file.separator");
File directory = new File(dir);
if (!directory.exists())
    return;
if (!directory.isDirectory()) {
    directory.delete();
String[] files = directory.list();
...
booleandeltree(String dir)
deltree
File f = new File(dir);
if (f.isDirectory()) {
    File[] files = f.listFiles();
    for (File ff : files)
        deltree(ff.getAbsolutePath());
return f.delete();
voiddeltree(String directory)
Recursive delete of a directory and all it's content
deltree(new File(directory));
voiddelTree(String dirName, String excludedDirName)
Recursive utility function that delete entire directory.
File dir = new File(dirName);
File[] files = dir.listFiles();
if (files != null) {
    for (int i = 0; i < files.length; i++) {
        if (files[i].isFile())
            files[i].delete();
        else {
            if (excludedDirName != null
...