i have a few processes on server windows 2003 servers (latest service packs, etc) that exhibit the same problem .. a random failure to delete a file they should be able to delete. this happens both from software i've written and from batch files (run from the task scheduler).
for example ... i have a program that opens an existing file then creates a log named the same as the file except with a different extension. when my program is done processing the file, it moves it to a subdirectory called "done" and then deletes the log. sometimes, however, my delete fails. there is no virus scanner installed on the machine that might keep the file open. my software is the only software that does anything with this file - heck, it created the file. and, yet, the file fails to delete. this software processes over 5000 files a week. some weeks i'll never get the error, others it will happen one or two times, apparently randomly. it is not a rights access thing and i'm baffled. it is not a problem i can replicate on demand; it just happens sometimes. it happens on multiple servers and from batch files as well as from my software.
has anyone encountered anything like this? i put an error trap in the delete and it appears to be getting an "Accessed Denied" type of error on delete.
--- ADDENDUM just another note ... yes, i tried delaying the delete after i close the file (see comment below). further, one of the batch files that i have does this ...
if exist my_lockfile.txt goto exit_this_batch echo here is a lock file > my_lockfile.txt call someother_program call more_programs call there_is_always_a_delay_of_at_least_a_minute_here del my_lockfile.txt :exit_this_batch
the batch file above ... about 1 in 10000 times will fail to delete. the delay between the creation with echo and the del is always at least a minute. weird. -don