0 seconds delay when deleting files in Explorer/Total Commander
When you try to delete a file or directory in Windows Explorer (or Total Commander) that is in use by another program, it takes a long time before an error message tells you that the file cannot be removed. With a little bit of research I’ve found that this happens because there is a 5 seconds delay in deleting the files, so a solution would be to make that delay 0 seconds by patching the shell32.dll. The process is a little complicated so if you do not really understand something is better not to try it. This was tested on Windows XP and I recommend doing a backup before trying it. Here are the steps:
- First of all you need to make sure that there is only one shell32.dll file. Thus, go to C:\Windowssystem32dllcache (assuming C is your system partition) and rename shell32.dll (if it exists) to shell32.dll.bak
- Now you will need a hex editor to patch the shell32.dll file. I used Tiny Hexer (which is free) so you can download and install it.
- Next you need to copy shell32.dll from C:\Windowssystem32 to a location where you will edit it.
I’ve created a folder called temp on C that you can delete after the file is edited and you’ve overwritten the original one. Once the file shell32.dll is on the temp folder, right click it and send it to the Tiny Hexer program, as you can see in the image below:
- Now you will need to do some changes in the hex string 8bff558bec565733ffeb2183ff05 (that appears twice in the file). In Tiny Hexer go to Edit->Find, paste the hex string I’ve mentioned above and click on Find.
- On both occurrences of the hex string the ending digits are 05. Those need to become 00. Note that you don’t have to hit delete and after that write the 0, but instead you have to put your cursor before 5 and press on 0, the last digit will be automatically replaced. Do this on the first occurrence:
and on the second occurrence
- Now that these changes are done click on Save. You’ll see that automatically a .bak file is created too, but you will need the shell32.dll file. If you try to copy this modified file to C:\Windowssystem32 you’ll get an error, this is why you have to rename first the shell32.dll file from C:\Windowssystem32 to shell32.dll_. When you’ll do this an error will appear (regarding the windows protection) and you have to click Yes to be able to continue.
- Now you can copy the shell32.dll file that you edited from the temp folder to C:\Windowssystem32.
- Last thing to do is restarting the computer. If everything works fine you’ll see that there is no delay now when trying to delete locked files
You can also read more on these websites:
Eliminating the delay when deleting in-use files/dirs
Eliminating Explorer’s delay when deleting an in-use file
[update]Well this hack was posted on Digg and I’ve seen a lot of comments and other tips. Here are some more details:
- first of all what this hack does is not deleting files in use, but removing the 5 seconds delay in receiving the answer from Windows when deleting a file in use. You know, this must have happened to you too, you hit delete on a file and no answer, you hit delete again and it just blocks. Removing this 5 seconds delay will give you the “Cannot delete message” faster, avoiding the block. This also works on Total Commander.
- if you need a solution to delete locked/in use files, you can use Unocker, a nice program that acts as an Windows Explorer add-in (yeah, it doesn’t work in Total Commander)
- last but not the least, for those that are worried on what they can mess by patching the shell32.dll file, you must know that there are ways to revert to the previous state of that file. In step 6 above you see that the Tiny Hexer program created a shell32.dll.bak file, so if something goes wrong you can remove the .bak extension and copy that file back to the original location. Or, if that’s too complicated, you can use the System File Checker tool from Windows that will “scan all protected system files immediately and replaces incorrect versions with correct Microsoft versions”. Basically you hit Start->Run, type sfc /scannow and press Enter. You’ll get prompted to enter your Windows CD in to restore the system file that was changed. Don’t trust me on this, read the more detailed procedure from Microsoft.