How to determine if a file will be logically moved or physically moved.

Posted by Frederic Morin on Stack Overflow See other posts from Stack Overflow or by Frederic Morin
Published on 2009-04-10T06:14:32Z Indexed on 2010/04/26 1:33 UTC
Read the original article Hit count: 468

Filed under:
|
|
|

The facts:

When a file is moved, there's two possibilities:

  1. The source and destination file are on the same partition and only the file system index is updated
  2. The source and destination are on two different file system and the file need to be moved byte per byte. (aka copy on move)

The question:

How can I determine if a file will be either logically or physically moved ?

I'm transferring large files (700+ megs) and would adopt a different behaviors for each situation.


Edit:

I've already coded a moving file dialog with a worker thread that perform the blocking io call to copy the file a meg at a time. It provide information to the user like rough estimate of the remaining time and transfer rate.

The problem is: how do I know if the file can be moved logically before trying to move it physically ?

© Stack Overflow or respective owner

Related posts about java

Related posts about nio