-
Enhancement
-
Resolution: Not an Issue
-
P4
-
None
-
None
-
generic
-
generic
A DESCRIPTION OF THE PROBLEM :
`Files` provides many convenient utilities. However, when you need to simply rename a file, you still have to jump through some loops
1. You have to use a semantically incorrect `move()` method
2. You have to specify the path to your file twice
```java
@SneakyThrows
void renameFile() {
Path source = Paths.get("foo/bar/baz/text.txt");
Path target = Paths.get("foo/bar/baz/text2.txt");
Files.move(source, target);
}
```
It would be much better if `Files` provided a `rename(Path file, String newName)` method OOB
`Files` provides many convenient utilities. However, when you need to simply rename a file, you still have to jump through some loops
1. You have to use a semantically incorrect `move()` method
2. You have to specify the path to your file twice
```java
@SneakyThrows
void renameFile() {
Path source = Paths.get("foo/bar/baz/text.txt");
Path target = Paths.get("foo/bar/baz/text2.txt");
Files.move(source, target);
}
```
It would be much better if `Files` provided a `rename(Path file, String newName)` method OOB