you probably won’t like this answer but the problem most likely resides with the OS i.e. windows XP and file locking. If you can try the same thing on a different OS such as windows server and see if you get the same issue
Here is a techmail from ZDNet http://www.zdnet.com.au/
moving the file to error directory would have the same issues as deleting
May 18, 2004
Delete an “undeletable” file
Have you ever tried to delete a file in Windows Explorer and received the error message that it could not delete the file because it was in use? This can happen even when you know for a fact that the file is not in use.
You may open a command prompt and try to delete the file with the Delete command. But this method also fails.
Here’s how you can delete an “undeletable” file. Follow these steps:
- Close all open programs.
- Open a command prompt.
- Right-click the taskbar, and select Task Manager.
- On the Processes tab, select Explorer.exe, and click the End Process button.
- Minimise Task Manager, but don’t close it.
- At the command prompt, use the Delete command to remove the file, and close the command prompt.
- In Task Manager, go to File | New Task (Run).
- In the Create New Task dialog box, enter Explorer.exe, and click OK.
- Close Task Manager.