Here you can find the source of copyRecursive(Path source, Path target, CopyOption... options)
public static void copyRecursive(Path source, Path target, CopyOption... options) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.IOException; import java.nio.file.*; import java.nio.file.attribute.BasicFileAttributes; public class Main { public static void copyRecursive(Path source, Path target, CopyOption... options) throws IOException { Files.walkFileTree(source, new SimpleFileVisitor<Path>() { @Override/*from ww w . j a v a2 s .c o m*/ public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException { Files.createDirectories(target.resolve(source.relativize(dir))); return FileVisitResult.CONTINUE; } @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { Files.copy(file, target.resolve(source.relativize(file)), options); return FileVisitResult.CONTINUE; } }); } }