Generally when manipulating files you used a named
<cflock> instead of a scope like so:
<cflock name="#Variables.myFileName#" timeout="5"
type="exclusive">
In your code in the second example I'm not sure about the
function of the loop at all... I guess you are trying to delay to
make sure the copy operation completes before deleting. But looping
from 1 to 10 is arbitrary and depending on other concurrent
processes, server speed, RAM, etc. and so basically it is
unreliable.