android文件重命名

来源:互联网 发布:msqrd相似的软件 编辑:程序博客网 时间:2024/05/16 12:48
/** * 对文件重命名 * @param filePath  文件的路径 */public void chageFileName(String filePath,String reName){File file = new File(filePath);//前面路径必须一样才能修改成功String path = filePath.substring(0, filePath.lastIndexOf("/")+1)+reName+filePath.substring(filePath.lastIndexOf("."), filePath.length());File newFile = new File(path);file.renameTo(newFile);}

0 0
原创粉丝点击