I cannot figure out what I am doing wrong, I'm just going off what the task gave me and all it was was the function syntax and parameters, so I'm going off what I've learned. If possible, I would like an explanation for the solution, so I can resolve other things, thanks!
package en.codegym.task.pro.task15.task1519;
import java.io.IOException;
import java.nio.file.DirectoryStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Scanner;
/*
Shallow copy
*/
public class Solution {
public static void main(String[] args) throws IOException {
Scanner scanner = new Scanner(System.in);
Path sourceDirectory = Path.of(scanner.nextLine());
Path targetDirectory = Path.of(scanner.nextLine());
DirectoryStream<Path> files = Files.newDirectoryStream(sourceDirectory);
for (Path path : files) {
if (Files.isRegularFile(path)) {
Path n = Files.copy(path, targetDirectory);
}
}
}
}