RyanTAdams.com

Technology Advice by Ryan Taylor Adams

Deleting Files “in Use”

June 11th, 2008 · No Comments · Printer Friendly Version

WARNING! THIS POST IS MORE THAN 180 DAYS OLD!

While I make an effort to update older posts to keep them relevant and technically accurate, the rapidly changing nature of the tech world makes it possible that the content of this post may no longer be relevant, current, or even accurate. Additionally, because of this post's age, adding new comments has been disabled. If you would like to contribute new information to this post, or have questions pertaining to this post, please use the Contact Form.


If you have ever tried to delete a file, while it was still opened by a program, you probably received an error message to the effect of “Cannot delete file: Access is denied”. There are several other variations of this error, including:

  • Cannot delete file: Access is denied
  • There has been a sharing violation.
  • The source or destination file may be in use.
  • The file is in use by another program or user.
  • Make sure the disk is not full or write-protected and that the file is not currently in use.

All of these mean the same thing. The file is in use by a program, and you can’t delete it until that program is closed. What do you do then when there aren’t any programs actually using the file?


Sometimes, a program (or even the Windows operating system) will fail to properly “let go” of a file it was using. The surefire way to get around the above errors is usually to restart your computer. This will force the offending program to close, and clear everything out of memory. When your computer restarts, you should be able to delete the file without a hitch.

Sometimes, rebooting is inconvenient or impossible. Other times, you want to know what specific program was causing the issue to begin with. In these situations, you can use Process Explorer to help. Download and run Process Explorer. If this is your first time using the program you will be prompted to accept the license agreement. Then:

  1. Click “Find” on the menu bar. Select “Find Handle or DLL”.
  2. In the window that opens, type the name of the file you are unable to delete.
  3. Press search.
  4. The results will list all the process that have that file open. Hopefully there are only a few.
  5. Double click on the first result. This will take you back to the main Process Explorer window. In the lower pane you will see the file you searched for listed.
  6. Right click on the file in the lower pane. And select “Close Handle”. Confirm the action if asked.
  7. Repeat steps 1-6 until the search return no more results.

You should now be able to delete the file without encountering an error message.