Files.move(source, target)
package sample;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
public class MoveExample {
public static void main(String[] args) throws Exception {
Path source = Paths.get("foo/bar/note.txt");
Path target = Paths.get("temp/bar/note2024.txt");
Files.move(source, target);
}
}
Run: