String path = "D:\\a1.pdf";
File f = new File(path);
// f.setExecutable(true);
// f.setWritable(true);
// f.setReadable(true);
String newPath = path.replace("a1.pdf", "重命名.pdf");
File newf = new File(newPath);
// newf.createNewFile();
boolean status = f.renameTo(newf);
System.out.println(status);
Java File 如何重命名
最新推荐文章于 2023-08-24 09:38:10 发布