The following example shows how to delete a non empty directory. The delete
method deletes the directory if and only if the directory is empty. To delete a
non empty directory, we need to recursive delete all its content and finally the
actually directory.
/**
* @param args
*/ public static void main(String[] args) {
File dir2Delete = new File("C:\\ABC");
//dir2Delete.delete() returns
//true if and only if the file or directory is successfully deleted; false otherwise
//NOTE : The directory will not be deleted unless the directory is empty
// So to delete a directory we need to delete its contents recursively.
System.out.println("File deleted successfully : " + dir2Delete.delete());