Java File Rename renameFile(File file, String sign, String suffix)

Here you can find the source of renameFile(File file, String sign, String suffix)

Description

rename File

License

Apache License

Declaration

public static void renameFile(File file, String sign, String suffix) 

Method Source Code


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

import java.io.File;

public class Main {

    public static void renameFile(File file, String sign, String suffix) {
        String name = file.getAbsolutePath();
        int index = name.lastIndexOf(suffix);
        String newName = name.substring(0, index) + "_" + sign + name.substring(index, name.length());
        file.renameTo(new File(newName));
    }//ww w .  j a  v  a  2  s  .  c o m
}

Related

  1. renameFile(File file, String newFilename)
  2. renameFile(File file, String newName)
  3. renameFile(File file, String newName)
  4. renameFile(File file, String newName)
  5. renameFile(File file, String newName)
  6. renameFile(File source, File dest)
  7. renameFile(File sourceFile, String newFileName)
  8. renameFile(File src, File dest)
  9. renameFile(File src, File dest)