更新时间:2023-11-09 08:28:04
以下代码怎么样
public void copyFolder(File src, File dest) throws IOException {
try (Stream<Path> stream = Files.walk(src.toPath())) {
stream.forEachOrdered(sourcePath -> {
try {
Files.copy(
/*Source Path*/
sourcePath,
/*Destination Path */
src.toPath().resolve(dest.toPath().relativize(sourcePath)));
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
});
}
}