Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Often on my development workstation (on which I am administrator and the only user), I am unable to delete files by deleting the root folder - despite having recursively taken ownership of the tree. I am presuming that this is due to the file being locked by another process.

What (scriptable) options do I have that can help here?

Comment: I should have also said that I'm on 2008 x64.

share|improve this question
1  
Be careful with solutions which close the file handle, since they might cause unpredictable corruption. See technet.microsoft.com/en-us/magazine/… for details. –  CesarB Jul 29 '09 at 17:50

5 Answers 5

up vote 11 down vote accepted

You could use LockHunter to see which process is blocking the deletion of a file. It's a freeware tool for Windows (32 bit and 64 bit versions available) which integrates itself into the Windows Explorer context menu.

It is a free tool to delete files blocked by something you do not know. LockHunter is useful for fighting against malware, and other programs that are blocking files without a reason. Unlike other similar tools it deletes files into the recycle bin so you may restore them if deleted by mistake.

LockHunter Screenshot

share|improve this answer
    
Looks good - 64 bit support too :) –  Sean Kearon Jul 29 '09 at 12:36
1  
Having now used this software, I like it even more than Unlocker (which I've used for ages when on 32 bit OS). This puppy is slicker to use and works on x64 too, which is great! Okay, it's not scriptable, but I have added a feature request on their site that is becomes so...I'll wait and see. Thanks splattne! –  Sean Kearon Jul 29 '09 at 21:40

With MoveFile from Sysinternals you can schedule the deletion for next reboot or you could try to unlock the file with Unlocker.

share|improve this answer
    
Thanks jonelf - unfortunately Unlocker does not currently support 64 bit OS and I don't want to have to reboot to delete the files. –  Sean Kearon Jul 29 '09 at 12:34

I posted this on this thread. Basically I use Systernal's Process Monitor to see what's locking the file. This How-to is great on how-to use it for this purpose.

share|improve this answer

If the file is locked via another process then use ffunlocker.

It isn't a scriptable solution but it is worth mentioning.

share|improve this answer

unlocker is great for doing this [right click, unlock]

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.