public final static boolean deleteDir(File dir, TaskMonitor monitor) throws CancelledException {
		File[] files = dir.listFiles();
		if (files == null) {
			return dir.delete();
		}

		monitor.initialize(files.length);

		for (int i = 0; i < files.length; i++) {
			monitor.checkCancelled();
			if (files[i].isDirectory()) {
				// use a dummy monitor as not to ruin our progress
				if (!doDeleteDir(files[i], monitor)) {
					printDebug("Unable to delete directory: " + files[i]);
					return false;
				}
			}
			else {
				monitor.setMessage("Deleting file: " + files[i]);
				if (!files[i].delete()) {
					printDebug("Unable to delete file: " + files[i]);
					return false;
				}
			}
			monitor.incrementProgress(i);
		}

		return dir.delete();
	}
Delete a directory and all of its contents

@param dir the dir to delete
@param monitor the task monitor
@return true if delete was successful. If false is returned, a partial
        delete may have occurred.
@throws CancelledException if the operation is cancelled
Ghidra/Framework/Utility/src/main/java/utilities/util/FileUtilities.java