Java tutorial
import static java.nio.file.StandardCopyOption.REPLACE_EXISTING; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; public class Main { public static void main(String[] args) { Path copy_from_2 = Paths.get("C:/tutorial/Java/JavaFX", "tutor.txt"); Path copy_to_2 = Paths.get("C:/tutorial/Java/Swing", "tutor.txt"); try (InputStream is = new FileInputStream(copy_from_2.toFile())) { Files.copy(is, copy_to_2, REPLACE_EXISTING); } catch (IOException e) { System.err.println(e); } } }