“Cannot delete file : access denied. Make sure the disk is not full or write-protected and that the file is not currently in use.” Almost all computer users must have encountered this problem while trying to delete a file or folder.
Sometimes it may take lot of time to figure out which program is using the specified file or folder. Some times you end up restarting the system to delete the specified file or folder.
If you can find out which program is using the file or folder, then it is easy to remove the file. You can close the application or kill the application to delete the file or folder. Similar problem may arise when you try to rename a file or folder or move a file or folder.
Related:
Monitor Folder Changes and Monitor Folder Size in Windows
Best Tools To Synchronize Folders Between Computers and Drives
Handle to find the handles!
How do you find out which program has a particular file or directory open? Handle from Windows Sysinternals is a nice utility that will help you to find out who is using the specific file or folder. You can use it to see the programs that have a file open, or to see the object types and names of all the handles of a program.
Handle is a command line utility. You can use it without installing it. Open the command prompt and navigate to the directory where the Handle utility is available and type “handle”. There are many optional parameters available. Just by typing ‘handle’ will display information about all types of handles, not just those that refer to files.
Usage,
1 2 3 4 5 6 7 8 9 10 | handle [[-a] [-u] | [-c <handle> [-l] [-y]] | [-s]] [-p <processname>|<pid>> [name] where -a Dump information about all types of handles, not just those that refer to files. Other types include ports, Registry keys, synchronization primitives, threads, and processes. -c Closes the specified handle (interpreted as a hexadecimal number). You must specify the process by its PID. WARNING: Closing handles can cause application or system instability. -l Dump the sizes of pagefile-backed sections. -y Don't prompt for close handle confirmation. -s Print count of each type of handle open. -u Show the owning user name when searching for handles. -p Instead of examining all the handles in the system, this parameter narrows Handle's scan to those processes that begin with the name process. |
For example , I have one folder “Presentations” in my disk, and I opened one command prompt to list down the files in the same directory. Without closing that command prompt, I tried to delete the folder “Presentations”. Now windows pop up the following message.
Using the “Handle” you can find out which program is using the folder “Presentations”. Just type “handle presentation”. The tool will display all the handles related to the folder Presentations”.
The above scenario is a simple one. In certain cases you may not be knowing if the file is used by some program which is running in the background. Handle can help you in all these situations
Download Handle
Before you go, subscribe to get latest technology articles right in your mailbox!.