I have struggled with moving files to another drive during renaming on Windows (e.g. from D:\Somefile.mkv to E:\RenamedFile.mkv). Everytime it would fail with an AtomicMoveNotSupportedException.
After browsing through the latest code from SVN I realized, that FileBot should use copy+delete operation from apache commons when the standard move fails. However, it only catches LinkageException in these cases:
File: source/net/sourceforge/tuned/FileUtilities.java (ll. 54 - 60)
Code: Select all
// move file
try {
// * On Windows ATOMIC_MOVE allows us to rename files even if only lower/upper-case changes (without ATOMIC_MOVE the operation would be ignored)
java.nio.file.Files.move(source.toPath(), destination.toPath(), StandardCopyOption.REPLACE_EXISTING, StandardCopyOption.ATOMIC_MOVE);
} catch (LinkageError e) {
org.apache.commons.io.FileUtils.moveFile(source, destination); // use "copy and delete" as fallback if standard rename fails
}
File: source/net/sourceforge/tuned/FileUtilities.java (ll. 54 - 60)
Code: Select all
// move file
try {
// * On Windows ATOMIC_MOVE allows us to rename files even if only lower/upper-case changes (without ATOMIC_MOVE the operation would be ignored)
java.nio.file.Files.move(source.toPath(), destination.toPath(), StandardCopyOption.REPLACE_EXISTING, StandardCopyOption.ATOMIC_MOVE);
} catch (LinkageError | AtomicMoveNotSupportedException e) {
org.apache.commons.io.FileUtils.moveFile(source, destination); // use "copy and delete" as fallback if standard rename fails
}
It'd be great if you could incorporate this fix, because I'm sure not the only one who wants to move files between drives in Windows
