14 May, 2011

Can’t copy a file: The file is in use by another process…?

Often you run into the file copy issue (“the file is in use by another process”). Sometimes it is evident who is the active process using your file, other times it can be a little complicated to determine who is indeed holding on to your file you are trying to copy from or to.

Unable to copy

Well – to determine this in a quite robust way; you have the luxury of using ‘ProcesExplorer’ by SysInternals. Follow this recipe to see how to determine the exact process (PID) holding on to your assembly.

Example:
I
want to copy an assembly (FIMLoggingActivityLibrary.dll) like this:

Development machine –> Test machine

But, when I attempt this, I’m presented with the below dialogs:

image

File Copy failure

I know the name of the assembly I want to replace (FIMLoggingActivityLibrary.dll), so armed with this knowledge, I can use ProcessExplorer to find the hosting process:

Press ‘Find’ – ‘Find Handle or Dll…’

Process Explorer

next – enter the known part of the file name you want to search for:

Process identified

Here you have the name and ProcessID (PID) of the process holding on to your file. Now, either shut the process down in a nice fashion (in the above case using Control Panel – Services) or in a rude manner using Process Kill from Task Manager. This really depends on the situation what you do here.

Service Manager

When this process is stopped or restarted, you are able to copy the file initially requested.

Technorati Tags: ,

No comments:

InRiver: Not loading your extensions?

(You really need to in the loop to appreciate the issue this post addresses). Man, I've been fighting this problem for hours before I ...