A common problem that novice users face is that the file or folder (due to some file) that needs to be deleted is not deleted. At the same time, the system writes the file is busy by another process or the action cannot be performed, since this file is open in Program_Name or that you need to ask permission from someone. This can be encountered in any version of the OS - Windows 7, 8, Windows 10 or XP.
In fact, there are several ways to delete such files at once, each of which will be considered here. Let's see how to delete a file that cannot be deleted without using third-party tools, and then I will describe the removal of busy files using LiveCD and the free Unlocker program. I note that deleting such files is not always safe. Be careful that this does not turn out to be a system file (especially when you are informed that you need permission from TrustedInstaller). See also: How to delete a file or folder if it says An element was not found (this element could not be found) .
Note: if the file is not deleted not because it is used, but with a message indicating that access is denied and you need permission to perform this operation or if you need permission from the owner, then use this guide: How to become the owner of a file and folder in Windows or Request permission from TrustedInstaller (also suitable for the case when you need to request permission from Administrators).
Also, if the pagefile.sys and swapfile.sys, hiberfil.sys files are not deleted, then the methods below will not help. Instructions about the Windows Paging File (the first two files) or about disabling hibernation will come in handy. Similarly, a separate article on how to delete the Windows.old folder may be useful.
Delete a file without additional programs
The file is already in use. Close the file and try again.
As a rule, if the file is not deleted, then in the message you see which process it is busy with - it could be explorer.exe or some other problem. It is logical to assume that to remove it, you need to make the file “not busy”.
This is easy to do - run the task manager:
- In Windows 7 and XP, you can get to it by Ctrl + Alt + Del.
- In Windows 8 and Windows 10, you can press the Windows + X keys and select the task manager.
Find the process using the file you want to delete and uncheck the task. Delete the file. If the file is busy with the process explorer.exe, then before you remove the task in the task manager, run the command line as administrator and, after removing the task, use the command del full_path_to_file on the command line to delete it.
To return to the standard desktop view after that, you need to run explorer.exe again. To do this, select “File” - “New Task” - “explorer.exe” in the task manager.
Details about the Windows Task Manager
Delete a locked file using a bootable USB flash drive or disk
Another way to delete such a file is to boot from any LiveCD drive, from the resuscitation disk of a system, or from a bootable Windows flash drive. When using LiveCD in any of its variants, you can use either the standard graphical interface of Windows (for example, in BartPE) and Linux (Ubuntu), or by means of the command line. Please note that when booting from a similar drive, your computer’s hard drives may appear under different letters. To make sure that you delete the file from the desired drive, you can use the dir c: command (this example displays a list of folders on drive C).
If you are using a bootable USB flash drive or installation disk for Windows 7 and Windows 8, at any time during installation (after the language selection window has loaded and in the following steps), press Shift + F10 to enter the command line. You can also select "System Restore", a link to which is also present in the installer. Also, as in the previous case, pay attention to the possible change of drive letters.
Using DeadLock to unlock and delete files
Since the Unlocker program discussed later, even from the official site recently (2016), began to install various unwanted programs and is blocked by browsers and antiviruses, I propose to consider an alternative - DeadLock, which also allows you to unlock and delete files from your computer (it also promises to change the owner, but in my tests didn’t work).
So, if, when deleting a file, you see a message stating that the action cannot be performed, because the file is open in some program, then using DeadLock in the File menu you can add this file to the list, and then, using the right one click - unlock it (Unlock) and remove (Remove). You can also perform file movement.
Although the program is in English (a Russian translation may appear soon), it is very easy to use. The disadvantage (and for some, perhaps, the advantage) - unlike Unlocker, does not add the action of unlocking the file to the context menu of the explorer. You can download DeadLock from the official site http://codedead.com/?page_id=822
Free Unlocker program for unlocking files that are not deleted
Unlocker is probably the most popular way to delete files that are used by a process. The reasons for this are simple: it is free, regularly copes with its task, in general, it works. You can download Unlocker for free on the official website of the developer http://www.emptyloop.com/unlocker/ (the site has recently been identified as malicious).
Using the program is very simple - after installation, just right-click on a file that is not deleted and select "Unlocker" in the context menu. If you are using the portable version of the program, which is also available for download, run the program, a window will open to select the file or folder that you want to delete.
The essence of the program is the same as in the first described method - unloading from memory the processes that the file is occupied. The main advantages over the first method - using the Unlocker program, it is easier to delete a file and, moreover, it can find and complete a process that is hidden from the eyes of users, that is, inaccessible for viewing through the task manager.
Update 2017: Another way, judging by the reviews, which worked successfully, was proposed in the comments by the author Toha Aytishnik: install and open the 7-Zip archiver (free, it works like a file manager) and rename the file in it, which is not deleted. After that, the removal is successful.
Why the file or folder is not deleted
Some background information from the Microsoft website, if anyone is interested. Although the information is rather scarce. It may also be useful: How to clean the disk from unnecessary files .
What may interfere with the deletion of a file or folder
If you do not have the necessary rights in the system to modify the file or folder, you cannot delete them. If you did not create the file, then there is a possibility that you cannot delete it. Also, the settings made by the administrator of the computer may serve as the reason.
Also, a file or folder containing it cannot be deleted if the file is currently open in the program. You can try to close all programs and try again.
Why, when I try to delete a file, Windows says that the file is being used
This error message means that the file is being used by the program. Thus, you need to find a program that uses it and either close the file in it, if it is, for example, a document, or close the program itself. Also, if you are working on a network, the file may be used by another user at the moment.
After deleting all files, an empty folder remains
In this case, try closing all open programs or restarting the computer, and then delete the folder.