code: public static void deleteDirectorySilently(final File dir) {
      if (dir != null) {
        try {
          FileUtils.deleteDirectory(dir);
        } catch (final IOException e) {
          log.error("error when deleting dir {}", dir, e);
        }
      }
    }
docs: Delete a directory, log the error if deletion fails.