posted 20 years ago
How about this?
Client polls for file "EvilFile" and finds it.Client creates temporary file "EvilFile_deleting" and locks it. If either part of this step fails, another client is contending to delete the file. First to succeed should probably win and proceed.Client copies original file and deletes it.Client unlocks and deletes the temporary lock file.
You'd think that you could delete a file you had locked, though. Can you rename it before copying it? That would stop other clients from seeing it between the time you unlock and delete it.