private void deleteFolders(TaskMonitor monitor) throws CancelledException {

		long start_ts = System.currentTimeMillis();

		try {
			monitor.initialize(foldersToDelete.size());
			monitor.setMessage("Deleting directories...");
			List<DomainFolder> sortedFolders = new ArrayList<>(foldersToDelete.keySet());
			Collections.sort(sortedFolders,
				(o1, o2) -> o2.getPathname().compareTo(o1.getPathname()));
			for (DomainFolder folder : sortedFolders) {
				monitor.checkCancelled();
				try {
					folder.delete();
					monitor.incrementProgress(1);
				}
				catch (IOException e) {
					foldersToDelete.put(folder, e.getMessage());
					erroredFolderCount++;
				}
			}
		}
		finally {
			long end_ts = System.currentTimeMillis();
			elapsedTime += (end_ts - start_ts);
		}
	}
Attempts to delete the folders listed in {@link #foldersToDelete} (in reverse
lexical order to delete child folders first before attempting to delete the
containing parent folders).
<p>
Errors are saved into {@link #foldersToDelete} as the value that the folder maps to.

@param monitor
@throws CancelledException
Ghidra/Framework/Project/src/main/java/ghidra/framework/main/projectdata/actions/ProjectDataDeleteTask.java