Java File Rename renameFile(String oldFileName, String newFileName)

Here you can find the source of renameFile(String oldFileName, String newFileName)

Description

rename File

License

Apache License

Declaration

static public boolean renameFile(String oldFileName, String newFileName) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.io.File;

public class Main {
    static public boolean renameFile(String oldFileName, String newFileName) {
        boolean success = false;
        try {/*from   w  w w . ja  v  a 2 s .  c o  m*/
            File fileToRename = new File(oldFileName);
            success = fileToRename.renameTo(new File(newFileName));
        } catch (Exception e) {
        }
        return success;
    }
}

Related

  1. renameFile(String filePath, String descFilePath)
  2. renameFile(String from, String to, String baksuffix)
  3. renameFile(String fromFilename, String toFilename)
  4. renameFile(String newName, String oldName)
  5. renameFile(String oldFile, String newName)
  6. renameFile(String oldname, String newname)
  7. renameFile(String oldname, String newname)
  8. renameFile(String oldname, String newone)
  9. renameFile(String oldPath, String newName)