Но я получаю следующее исключение:
Код: Выделить всё
java.nio.file.AccessDeniedException: oldfilename -> newfilename
at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:83)
at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97)
at sun.nio.fs.WindowsFileCopy.move(WindowsFileCopy.java:387)
at sun.nio.fs.WindowsFileSystemProvider.move(WindowsFileSystemProvider.java:287)
at java.nio.file.Files.move(Files.java:1345)
Целевой путь не существует до вызова Files.move().
ОБНОВЛЕНИЕ
Из javadoc:
Код: Выделить всё
When moving a directory requires that its entries be moved then this method fails
(by throwing an IOException).
Подробнее здесь: https://stackoverflow.com/questions/229 ... files-move