Part 1: Using SysInternals Process Explorer to solve issues when trying to clean up files and folders...

This is a fairly common problem which leaves a lot of users scratching their heads as to how to just make things work. There are a couple reasons one would encounter this. The most common is because an application or process still has the file open (technically it's called a 'handle to the file'). Another possibility would be if the permissions on the file you were trying to delete were invalid. Without getting too in depth into the how and why there are two quick things to check on when trying to get around the problem.

I'll go over the first reason in this post. In the Windows SysInternals suite, there is a tool called Process Explorer, which is an amazingly powerful app. It will allow you to view what's going on behind the scenes of most everything running on the system. Just doing quick search will show just how powerful this tool is. For this issue though, what we'll do is find any open handles on the file we're trying to access and delete.

  1. First, start Process Explorer.
  2. Press CTRL+F to open a search window.
  3. In the 'Handle or DLL substring' field type in a portion or the complete name of the file you are trying to delete and press Enter to begin the search. In my case the file was "08 mer du japon.mp3".
  4. You should now be presented with a list of open handles. Next double click on the handle in the search window to show the file handle highlighted in the lower pane along with all the other open handles on the system.
  5. Right click the row for the handle and click Close Handle.
  6. You should now be good to go.

In this particular case it would seem the handle to the .MP3 file wasn't properly closed by Windows Media Player despite it having finished playing and updating the metadata. Because of this I was unable to move the album folder. By using Process Explorer I was able to find the culprit and close down the handle which allowed Vista full access to move the file and folder. There are some other third-party tools available as well as other tips and ways of doing the same thing. However, I highly recommend the method I just described, as using and further exploring Process Explorer and the other tools available in the SysInternals suite of applications will allow you to gain a much greater understanding of your system.

This, combined with a few good search queries, a deep curiosity through Wikipedia, and the Microsoft Knowledge Base will help turn any enthusiast into a real power user. Check back shortly for part two where I discuss how to take back ownership of your files and folders through permissions in Windows Vista and Server 2008.

Questions and comments are always welcome.
Cheers,
Corey Gouker