According to: How do I rename (not move) a file in JDK7?
I'm trying to rename folder name of not empty folder with java NIO
My result , is new directory created without files inside and not delete old one.
The code i used but it doesn't work:
try (FileSystem fs = FileSystems.newFileSystem(uri, env)) {
Path oldPath = fs.getPath("/some/directory2");
Files.move(oldPath, oldPath.resolve("/some/directory_replaced2_2"), StandardCopyOption.REPLACE_EXISTING);
} catch (IOException e) {
e.printStackTrace();
}
What I'm missing ? ( I want only rename folder)