Sometimes Windows can be really, really stingy. For whatever reason, some or other application on Windows may make reference to a particular file on your system which of course results in a locked file – great because it allows for integrity when working with files but not so great when the application stops using a file and Windows simply takes its damn time unlocking the thing again!
Luckily for us though, that clever guy Nir Sofer over at http://www.nirsoft.net came up with the clever little OpenedFilesView application that essentially lists all the currently “open” files on your system, displaying for each open file the handle value, the type of access (read/write/delete), file position as well as the process that opened the file amongst other things. This little app then allows you to essentially force close these open files by either closing the handle via its own interface or alternatively killing the process it indicates is currently locking that annoying file.
In other words, finally the end to annoying error messages like these:
- Cannot delete [filename]: There has been a sharing violation. The source or destination file may be in use.
- Cannot delete [filename]: It is being used by another person or program. Close any programs that might be using the file and try again.
(Of course, you should note that forcing an open file closed could be potentially unstable for your system – though if you’re actually using this application you are most likely a power user – hence you should know what you are doing or at the very least, know how to recover from a disastrous mistake! :P)
Related Link: http://www.nirsoft.net/utils/opened_files_view.html