复制选项在这里列出:
import java.io.IOException; /** from * N o w J a v a . c o m - 时 代 Java **/ import java.nio.file.Files; import java.nio.file.LinkOption; import java.nio.file.Path; import java.nio.file.Paths; import java.nio.file.StandardCopyOption; public class Main { public static void main(String[] args) throws Exception { Path copy_from = Paths.get("C:/folder1/folder0/folder9", "draw_template.txt"); Path copy_to = Paths.get("C:/folder1/folder0/USOpen", copy_from/** 时 代 J a v a - nowjava.com 提 供 **/ .getFileName().toString()); try { Files.copy(copy_from, copy_to, StandardCopyOption.REPLACE_EXIST