Verified Commit 3042e116 authored by Lukas Wiest's avatar Lukas Wiest 🚂
Browse files

feat(util/FileUtil): add method for recursive folder copy

parent 13d3ce30
package de.hftstuttgart.utils; package de.hftstuttgart.utils;
import java.io.File; import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
/** /**
* Helper Class for all file related tasks. * Helper Class for all file related tasks.
...@@ -27,4 +30,14 @@ public class FileUtil { ...@@ -27,4 +30,14 @@ public class FileUtil {
folder.delete(); folder.delete();
} }
public static void copyFolder(Path src, Path dst) throws IOException {
Files.walk(src)
.forEach(source -> {
try {
Files.copy(source, dst.resolve(src.relativize(source)));
} catch (IOException e) {
throw new RuntimeException(e.getMessage(), e);
}
});
}
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment