public class DeleteDirectory extends Object implements DirectoryItemHandler
DeleteDirectory deletes directories
 from the local filesystem. It can optionally recurse through
 an entire directory tree and delete everything under a
 specified root directory.| Modifier | Constructor and Description | 
|---|---|
protected  | 
DeleteDirectory(boolean verbose)
Creates a new  
DeleteDirectory. | 
| Modifier and Type | Method and Description | 
|---|---|
static void | 
delete(String dir,
      boolean recurse,
      boolean delete,
      boolean verbose)
Deletes the contents of a directory, optionally deleting
 the contents of every subdirectory recursivley. 
 | 
boolean | 
handleItem(File f,
          int howDeep)
Defines  
DirectoryItemHandler. | 
protected DeleteDirectory(boolean verbose)
DeleteDirectory.verbose - if true, prints messages to System.out during the
                  directory traversal ("deleting file: public static void delete(String dir, boolean recurse, boolean delete, boolean verbose)
dir - the directory to deleterecurse - whether or not to delete the contents of every
                  subdirectory recursively.delete - whether or not to delete the root directory
                  (dir) after deleting all of its
                  contents.verbose - if true, prints messages to System.out during the
                  directory traversal ("deleting file: public boolean handleItem(File f, int howDeep)
DirectoryItemHandler.
 handleItem in interface DirectoryItemHandlerf - the current File being handled by
                  DirectoryTree.traverse.howDeep - how "deep" the traversal is in the tree, with
                  respect to the root folder in the local
                  filesystem. (i.e., if the current file is:
                  /foo/bar/a/b/x.txt and the root
                  of the traversal was specified as /foo/bar,
                  then howDeep == 2.)Copyright © 2025. All rights reserved.