Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

MOVE does not behaves like intended (on failure)

Aug
15
0
If MOVE should move a file, which is locked by another process, two things seems to happen:

(1) The file is being copied to it's destination. This is unnecessarily time-consuming, if the destination-drive is the same one as the source-drive and might fail, if there is not enough space on the destination-drive (for these two files).

(2) If succeeded, the original file is tried to be deleted, which does not work, because it is locked. So an error-message is displayed, which makes sense. Unfortunately the copied file is not tried to be deleted, so there is an unwanted/unexpected duplicate file in the destination-directory.

So it would be nice, if a failure occurs (1) no copying would happen, if the original file could not be removed or at least (2) the file-state would be the same as before (= no duplicated file)

Thanks a lot,
Michael
 
MOVE first tries a rename (which works most of the time locally). If the rename fails, then MOVE does a copy and deletes the original.

The problem is in getting a sensible error value from Windows, in order to determine exactly what happened and what the possible workarounds are. The usual Windows error on a rename failure is "access denied", which unfortunately can mean a lot of different things, most (but not all) of which can be resolved with the copy + delete. So unless Microsoft starts providing more detailed errors, that means the only ways to determine the real issue is either a file system filter driver or a lot of additional code in TCC to try to outguess Windows and find the real problem. At this point I'm unconvinced that either approach would be worthwhile, given that in the last 20 years we've had exactly one report (yours) on this issue.

The next question is whether it's a good idea to delete the new copy if the original couldn't be deleted - I suspect that most times users would want the file in the new location regardless of whether the original was deleted.
 

Similar threads

Back
Top