// 修改文件名 public static boolean modifyFileName(String serverPath, String oldFileName, String newLoginNo) { String oldPath = serverPath + "/" + oldFileName; String newPath = serverPath + "/" + newLoginNo + "-" + oldFileName.substring(oldFileName.indexOf('-') + 1); File oldFile = new File(oldPath); File newFile = new File(newPath); if (oldFile.renameTo(newFile)) { return true; } else { return false; } }