标签:sssss exist mss ali sts date() form bsp public
/** * 重命名文件 * @param fileName * @return */ public static void renameFile(String filePath, String fileName) { SimpleDateFormat fmdate = new SimpleDateFormat("yyyyMMddHHmmssSSS"); String oldFileName = filePath+"/"+fileName; File oldFile = new File(oldFileName); String newFileName = filePath+"/"+fileName.split("\\.")[0]+fmdate.format(new Date())+"."+fileName.split("\\.")[1]; File newFile = new File(newFileName); if (oldFile.exists() && oldFile.isFile()) { oldFile.renameTo(newFile); } }
标签:sssss exist mss ali sts date() form bsp public
原文地址:https://www.cnblogs.com/lizm166/p/10647781.html