0

I have shared a drive with Operating system: Windows Server 2008 R2 Enterprise Service Pack 1, then write some c++ codes to access this drive with windows API (WNetAddConnection2) from other computers in my organization through HTCondor (could be any windows system from XP to 8).

In some cases, the connection is successful and coping files from share drive, but the connection is suddenly failed. Finally, I cannot delete the files in my share drive.

I have to restart the shared computers and delete the files.

How could I delete files without restarting? Please let me know if my question is not clear.

Thanks for any suggestions.

1 Answer 1

1

Do you have physical access to the machine? If yes, since you know it is a network connection that is locking the file, you could temporarily disable the network connection which should release the locks. If you are accessing the computer remotely then this option obviously won't work since you'll lock yourself out too.

You can also use handle, which should show you which windows process has the file locked. Then you can kill just that process to release the handle (lock) on that file. Beware though that if the process you are killing is a necessary windows process, then this could cause instability, in which case you probably would end up needing to do a reboot anyway to recover.

2
  • Thanks for your suggestion. This is a virtual machine which have to be connected with remote desktop. Handle could be the best option for me now. Disable the shared drive could be another options. But it will be boring to reset permissions, etc.
    – Helend
    Commented Jun 18, 2014 at 4:39
  • I just noticed the system process with pid: 4 is handling the shared files.
    – Helend
    Commented Jun 18, 2014 at 4:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .