
I had done Let>CF_OVERWRITE=1, and then did a CopyFile>Source,Destination. I had not done any checks for copy success and later I was having some random problems based on the destination file.

Working back I found that sometimes the Destination file did not exist. Going back further, I found that it did not exist because the Source file was in use and the CopyFile did not copy to destination.

But the "old" Destination file had already been deleted.


===============================
//Rename old copy to keep for restoration if needed
MoveFile>old,temp
CopyFile>new, old
IfFileExists>old,Good
Message>Error copying new file to old
//Keep original "old" file that was deleted when CopyFile started
MoveFile>temp,old
GoTo>ErrorRoutine
Label>Good
//Remove original "old" file, not needed any longer
DeleteFile>temp
Goto>End
Label>ErrorRoutine
.....
.....
.....
Label>End
==================================
The simplified script above only does a check on the CopyFile instruction, but a verification could be done after each MoveFile, CopyFile, DeleteFile instruction.
I haven't done any test at this point to see what happens when CF_OVERWRITE is at default=0. I do not think this problem will occur. But if you do use CF_OVERWRITE=1, you should take the extra steps to copy the destination file until you are sure that the replacement file has been copied successfully.
Now that this has been written out, it seems obvious to me that this would happen. (Also need to follow up on the recent messages in the forum on identifying locked files).
As a general practice, all copy/write/delete routines should be verified, but those extra programming steps never seem important enough to put in the extra effort/time.

