0

フォルダー A: "/files/attachments/2000/filename.txt" からフォルダー B: "/files/attachments/trashbin/2000/filename.txt" にファイルを移動しようとしていますが、例外が引き続き発生します: FileAlreadyExistsException例外出力は「/files/attachments/trashbin/2000」です。

これはコードです:

Path filePath = Paths.get(pathOnNFS.concat(folderPath).concat(Utils.DELIMITER + fileName));
Path trashBinPath = Paths.get(trashBinNFS.concat(folderPath));
try {
    Files.createDirectories(trashBinPath);
    Files.move(filePath, trashBinPath.resolve(fileName), StandardCopyOption.REPLACE_EXISTING);
}catch(...){}

なぜそれが起こっているのか誰にも示唆できますか?これはドキュメントです: https://docs.oracle.com/en/java/javase/12/docs/api/java.base/java/nio/file/Files.html#move(java.nio.file.Path ,java.nio.file.Path,java.nio.file.CopyOption...)

4

0 に答える 0