50,541
社区成员
发帖
与我相关
我的任务
分享
/**
* 复制单个文件
*
* @param oldPath String 原文件路径
* @param newPath String 复制后路径
* @return boolean
*/
public static boolean moveFile(String oldPath, String newPath) throws IOException {
File startFile = new File(oldPath);
File file = new File(newPath);
if (file.exists()) {
return true;
}
return startFile.renameTo(file);
}