File sourceFile = new File(pathname + File.separator + oldName);
File targetFile = new File(pathname + File.separator + newName);
Path source = sourceFile.toPath();
Path target = targetFile.toPath();
try {
Files.move(source, target);
} catch (IOException e) {
e.printStackTrace();
}
【File】文件重命名
最新推荐文章于 2023-10-28 15:51:00 发布