Java File Rename renameFile(File sourceFile, String newFileName)

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

Description

rename File

License

Open Source License

Declaration

public static void renameFile(File sourceFile, String newFileName) 

Method Source Code


//package com.java2s;
import java.io.File;

public class Main {
    public static void renameFile(File sourceFile, String newFileName) {
        File targetFile = new File(sourceFile.getParent(), newFileName);
        sourceFile.renameTo(targetFile);
    }//from w  w  w .  j  a va 2 s  . c  o  m
}

Related

  1. renameFile(File file, String newName)
  2. renameFile(File file, String newName)
  3. renameFile(File file, String newName)
  4. renameFile(File file, String sign, String suffix)
  5. renameFile(File source, File dest)
  6. renameFile(File src, File dest)
  7. renameFile(File src, File dest)
  8. renameFile(File src, File dest, boolean overwrite)
  9. renameFile(File srcFile, File destFile)