Directory is not copied help me plzz
import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import static java.nio.file.StandardCopyOption.*; public class Main { public static void main(String[] args) throws IOException { Path p1 = Paths.get("path1\\"); Path p2 = Paths.get("path2\\new2\\"); //System.out.format("%s%n", Files.isReadable(p2)); //System.out.format("%s%n", p1.toAbsolutePath()); // System.err.format("error"); //System.out.format("getName()%s%n", p1.getName(0)); //System.out.format("FileName()%s%n", p1.getFileName()); //System.out.format(".toUri()%s%n", p1.getNameCount()); Files.copy(p2, p1, REPLACE_EXISTING); System.out.println(p2.getFileName() + " has been successfully copied to " + (p1.toAbsolutePath()) ); } }
output:
but i cant find anything in path1 directorynew2 has been successfully copied to F:\My Work\JAVA\Paths\path1