Reputation: 21
I have a bat file as part of larger maintenance system that runs on a nightly basis, performs a bit of housekeeping, SVN updating etc. Part of this involves moving/deleting files, however, occasionally this fails due to another process not releasing a handle on the files/dirs to be moved. Is there any way to force the BAT file to override any existing handles and continue with the MOVE? I can only think of a look up method using ProcessExplorer/Assassin - although I'm not sure that would even work. Alternatively a "sleep" and then reattempt if it failed the first time, although that would be a matter of luck than solving the underlying problem. Any ideas/suggestions much appreciated. Thanks.
Upvotes: 0
Views: 378
Reputation: 28100
Here are a few things that I have done in similar situations:
move
command, ensure that other script threads CD
out of the target directory./r:3
and wait /w:5
.COPY
so the script can continue working, then later in the script do the deletion at the old/unneeded location.MOVE
command.Upvotes: 0