Java Rename File reName(String s, String s1)

Here you can find the source of reName(String s, String s1)

Description

re Name

License

Apache License

Declaration

public static final void reName(String s, String s1) 

Method Source Code

//package com.java2s;
/*/*ww  w.j  a  v a 2  s.c  om*/
 * Copyright 2014-2024 the https://github.com/xiaoxing598/itganhuo.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * This project consists of JAVA private school online learning community group Friends co-creator [QQ group 329232140].
 * ????JAVA???????????????????[QQ?329232140];
 * See the list of IT dry technology sharing network [http://www.itganhuo.cn/teams].
 * ???????????IT???????[http://www.itganhuo.cn/teams];
 * The author does not guarantee the quality of the project and its stability, reliability, and security does not bear any responsibility.
 * ?????????????????????????????????????????.
 */

import java.io.File;

public class Main {
    public static final void reName(String s, String s1) {
        File file1 = new File(s);
        if (file1.exists()) {
            file1.renameTo(new File(s1));
        }
    }
}

Related

  1. rename(String from, String to)
  2. rename(String oldFile, String newFile)
  3. rename(String oldName, String newName)
  4. reName(String oldName, String newName)
  5. rename(String platformLibPath, String newPath)
  6. rename(String srcFilename, String destFilename)
  7. rename(String srcPath, String destPath)
  8. rename(String strFileName, String strRenameToName)
  9. rename(String was_name, String new_name)