public static void copyDirectory(Path from, Path to) throws IOException {
    LOG.info(from + " into " + to);

    Files.walkFileTree(from, new SimpleFileVisitor<>() {
      @Override
      public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException {
        if (dir != from || !Files.exists(to)) {
          Path copy = to.resolve(from.relativize(dir));
          LOG.info("  " + dir + " into " + copy);
          Files.createDirectory(copy);
        }
        return FileVisitResult.CONTINUE;
      }

      @Override
      public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
        Path copy = to.resolve(from.relativize(file));
        LOG.info("  " + file + " into " + copy);
        if (WIN_UNPRIVILEGED && attrs.isSymbolicLink()) {
          Files.createSymbolicLink(copy, Files.readSymbolicLink(file));
        }
        else {
          Files.copy(file, copy, COPY_STANDARD);
        }
        return FileVisitResult.CONTINUE;
      }
    });
  }
public static void copyDirectory(Path from, Path to)