I assume that you are referring to FileUtils.moveFile()
.
The moveFile
takes care of the case where the source and destination are on different directories. What it does is to try to use File.renameTo
, and if that fails, it tries to copy the file. (See the source code.) In short, you don't need to check for yourself ...
But in response to your actual question, neither File
or Apache FileUtils
provides a way to test if two directories are on the same file system. But (I think) you can do it using Java 7 functionality by something like this:
Path path1 = new File(str1).toPath();
Path path2 = new File(str2).toPath();
if (path1.getFileSystem().equals(path2.getFileSystem()) {
...