java 复制文件
import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths ;
import java.nio.file.Files;
Path sourcePath = Paths.get("/storage/emulated/0/Android/media/images/19/25.jpg"); Path destinationPath = Paths.get("/storage/emulated/0/Android/media/images/25.jpg"); try { Files.copy(sourcePath, destinationPath); System.out.println("文件已成功复制到目标位置。"); } catch(IOException e){ System.err.println("复制文件时出错:" + e.getMessage()); }
标签:Paths,java,nio,文件,复制,file,Path,import From: https://www.cnblogs.com/Demiwang/p/18129455