If you come across a situation where you are unable to delete a file and receive one of the errors below:
Cannot delete file: Access is denied
Cannot delete folder: There has been a sharing violation
Cannot delete file: It is being used by another person or program
Cannot delete folder: Make sure the disk is not full or write-protected and that the file is not currently in use.
Try the following:
1) Check that the file is not being used by another person. Access the server where the file is stored, right click My Computer, click manage, expand shared folders, click open files and check to see if the file is open.
2) If you find no one has the file open, download and run unlocker. Can be downloaded at: http://ccollomb.free.fr/unlocker/ . Once installed, right click on the file and click unlocker. Unlocker will help you kill the process or give you the option to delete the file when the server is next rebooted.
3) If unlocker is unable to locate the process or after a reboot, you find files are still being locked, the issue may be your Anti Virus software. I have come across this issue with McAfee 8.5. Disable the on access scanner or stop the McAfee services. Test again. If the issue is AntiVirus, see the Anti Virus developers website for patches to resolve the issue.
If you’re using McAfee 8.5 and have not yet installed any patches, see https://kc.mcafee.com/corporate/index?page=content&id=KB60415
One of the issues resolved in the above McAfee fix is shown below:
3. ISSUE:
Some files remain locked indefinitely. Third-party
tools indicate that McShield.exe was leaking
handles, thereby locking the file.
Please be careful when applying any updates, make sure you hold a successful backup of your server before attempting to update. If unsure, please see an I.T Professional.