openFile = new File(file.getPath()+"\\"+names);String newFileName = this.reName(openFile.getName());
String newFilePath = openFile.getParent()+"\\"+newFileName;

openFile.renameTo(new File(newFilePath));
原文件(目录)openFile ,重命名为newFileName ,执行renameTo后文件名不变,为什么??

解决方案 »

  1.   

    1、newFilePath有不合法字符
    2、newFilePath路径不合法
    3、openFile指向文件不存。
      

  2.   

    String newFileName = this.reName(openFile.getName()); 
    这个reName是怎么实现的,一般是传2个参数进去吧,新名字和旧名字,你把旧名字传进去感觉没变啊
      

  3.   

    reName 传的原文件名,返回一个新的文件名
      

  4.   

    有可能,建议贴下代码,把reName代码贴出来
      

  5.   

    public String reName(String name) { return "cpe_" + name; }