Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

My IDE is getting a frequent problem of failing to delete temporary or scratch files from the disk it is working on and the reason is the files and folders it is working on are being locked by itself and, probably for no reason, it's unable to unlock the files and folders by itself.

There's a tool called "unlocker" and "lock hunter" to unlock the locked files and folders but I don't want do that every time it happens. Is there anything I could do about this? Perhaps a tool that I could use for free to prevent my specific folders and files and folders inside it from being locked by any process?

By the way, the IDE is frequently creating files on that folder and are frequently modified.

share|improve this question
    
In theory you could write a background program to always keep a handle open to the files with everything but FILE_SHARE_DELETE turned on. But that seems like overkill. –  Andrew Lambert Dec 21 '12 at 8:16
2  
The locking of files by process that uses them is there by OS design. This is how things should be - otherwise two separate processes could interfere with each other. You should close the program/process that uses those files or make it close the handles to those files - not trying to remove them while some process is keeping the handles to them. Check if you have some extensive anti-virus checks performed all the time - maybe other process (like AV) is trying to scan those files while IDE is trying to remove them? –  mnmnc Dec 21 '12 at 8:45
    
The fact that lock hunter app is able to unlock the files without closing the program that uses it means closing apps is not necessary. For the AV, I don't have control over it since I'm using my office laptop. Weird enough I have admin rights except on some things like AV. –  supertonsky Dec 22 '12 at 9:46

2 Answers 2

Windows, and other operating systems, by design, use "handles" to access files and directories. These handles can provide a lock to prevent data corruption and read/write conflicts.

Although these handles can be forcibly closed, it's possible that doing so may crash your application or cause stability problems with Windows.

You may use an application called Process Explorer to search for these handles to determine exactly which handles belong to which processes. You may either kill the process (you will lose any unsaved data) or forcibly close the handle (this is like the file unlock tools you mentioned, your application/Windows may crash or become unstable), killing the process would be preferred.

I would recommend, if these if these files bother you while working, that you save your work, close or kill your IDE, delete the files and then re-open your work.

Additionally, I'd recommend that you contact either the community help or commercial support for your application. You mention that the application creates files frequently and modifies them frequently, in that case your IDE may be keeping those files around by design, perhaps like a cache or back-up for your unsaved changes or your undo history.

share|improve this answer
    
I just wanted an automatic unlocker. I know how to unlock those files and folders and certainly no problems with doing it, I just wanted to automate the process perhaps by a tool. Unlocking those files have no real issues on my IDE. –  supertonsky Dec 23 '12 at 17:06
    
It's like this, I'm working on a set of source and the IDE generates temporary files and folders somewhere I know. Now, every time rebuild happens it is failing to delete and recreate it's own working temporary files and folder for unknown reason. Those temporary files and folder are not not part of the source so it is OK to be deleted. I've got a feeling that there has been changes to the configuration of my IDE that made my IDE not to release the handles or unlock them whenever the IDE itself needs to delete it. That's why it keeps on complaining that it couldn't delete the files it generatd –  supertonsky Dec 23 '12 at 17:13

I faced the same dilemma. Here's the simple way. All folders that start with "MY" as in My Documents etc will have locked files. Move file ... or folder ... or image to the Public directory/folder and voila: the file is not locked any more.

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.