Is it possible to determine programmatically whether a file move will result in a copy? : <p>My Java program needs to synchronously move a file on a server, ie. within the same set of local file systems. The obvious solution is to use <a href="https://docs.oracle.com/javase/8/docs/api/java/nio/file/Files.html#move-java.nio.file.Path-java.nio.file.Path-java.nio.file.CopyOption...-" rel="noreferrer">Files.move()</a>.  However, I've read that in some cases, eg. across file systems, a move will fall-back to copy-and-delete. As I'm moving large files I'd like to be able to report progress to the user if a copy take places (as there will be a noticeable delay).</p>

<p>However, I cannot find a simple way to do this with the Java API. I could potentially write my own copy routine that reports progress, but then I would need to know if the move is going to result in a copy.</p>

<p>One possibility seems to be something like:</p>

<pre><code>try {
    Files.move(src, dest, CopyOption.ATOMIC_MOVE);
} catch (AtomicMoveNotSupportedException  e) {
    // Perform a copy instead (and report progress)
}
</code></pre>

<p>However it's not clear to me from the Java doco if this would be correct in all cases. Is this indeed a correct solution? If not, is there another way?</p>
