private static void cleanDirectory(@NotNull Path directory) {
    try (DirectoryStream<Path> stream = Files.newDirectoryStream(directory)) {
      for (Path path : stream) {
        if (!FILES_TO_KEEP.contains(path.getFileName().toString())) {
          try {
            NioFiles.deleteRecursively(path);
          }
          catch (IOException e) {
            System.err.println("Failed to delete " + path + ": " + e);
          }
        }
      }
    }
    catch (NoSuchFileException ignore) {
    }
    catch (IOException e) {
      System.err.println("Failed to clean directory " + directory + ": " + e);
    }
  }
private static void cleanDirectory(@NotNull Path directory)