Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

java rename file

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;

  //...

  Path source = Paths.get("/home/mkyong/newfolder/test1.txt");
  Path target = Paths.get("/home/mkyong/newfolder/test2.txt");

  try{

    Files.move(source, target);

  } catch (IOException e) {
    e.printStackTrace();
  }
Source by mkyong.com #
 
PREVIOUS NEXT
Tagged: #java #rename #file
ADD COMMENT
Topic
Name
1+5 =