File tree Expand file tree Collapse file tree
core-java-modules/core-java-io-3/src/main/java/com/baeldung/copydirectory Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,14 +9,14 @@ public class JavaNio {
99
1010 public static void copyDirectory(String sourceDirectoryLocation, String destinationDirectoryLocation) throws IOException {
1111 Files.walk(Paths.get(sourceDirectoryLocation))
12- .forEach(source -> {
13- Path destination = Paths.get(destinationDirectoryLocation, source.toString()
14- .substring(sourceDirectoryLocation.length()));
15- try {
16- Files.copy(source, destination);
17- } catch (IOException e) {
18- e.printStackTrace();
19- }
20- });
12+ .forEach(source -> {
13+ Path destination = Paths.get(destinationDirectoryLocation, source.toString()
14+ .substring(sourceDirectoryLocation.length()));
15+ try {
16+ Files.copy(source, destination);
17+ } catch (IOException e) {
18+ e.printStackTrace();
19+ }
20+ });
2121 }
2222}
You can’t perform that action at this time.
0 commit comments