public static void delete(Path file) throws IOException {
    if (Files.exists(file, LinkOption.NOFOLLOW_LINKS)) {
      Files.walkFileTree(file, new SimpleFileVisitor<>() {
        @Override
        public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
          tryDelete(file);
          return FileVisitResult.CONTINUE;
        }

        @Override
        public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException {
          tryDelete(dir);
          return FileVisitResult.CONTINUE;
        }
      });
    }
  }
public static void delete(Path file)