Twitter

Показ дописів із міткою delete. Показати всі дописи
Показ дописів із міткою delete. Показати всі дописи

четвер, 9 травня 2024 р.

How to delete a file that cannot be deleted - 3 ways

 

How to delete a file that cannot be deleted - 3 ways

remontka.pro
6 min
A common problem that novice users encounter is that a file or folder is not deleted (due to some file) that needs to be deleted. In this case, the system writes that the file is occupied by another process or the action cannot be performed because this file is open in Program_Name or that permission needs to be requested 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, each of which will be discussed here. Let's see how to delete a file that won't delete without using third-party tools, and then I'll describe how to delete busy files using LiveCD and the free Unlocker program. I note that deleting such files is not always safe. Be careful that it is not a system file (especially when you are told that you need permission from TrustedInstaller). See also: How to delete a file or folder if it says Element not found (could not find this element) .

Note: If the file is not being deleted because it is not in use, but with a message saying that access is denied and you need permission to perform this operation or need to request permission from the owner, then use this guide: How to take ownership 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 files pagefile.sys and swapfile.sys, hiberfil.sys are not deleted, then the methods below will not help. You will find the instructions about the Windows Page File  (the first two files) or about disabling hibernation useful. Likewise, a separate article on how to delete the Windows.old folder may be useful .

Deleting a file without additional programs

The file is already in use. Close the file and try again.
The file is already in use. Close the file and try again.

As a rule, if a file is not deleted, then in the message you will see which process is occupied by it - it could be explorer.exe or some other problem. It is logical to assume that in order to delete it, you need to make sure that the file is “not busy”.

This is easy to do - launch the task manager:

  • In Windows 7 and XP you can access it by Ctrl + Alt + Del.
  • In Windows 8 and Windows 10, you can press the Windows key + X and select Task Manager.
The file is already in use. Close the file and try again.
The file is already in use. Close the file and try again.

Find the process that is using the file you want to delete and kill the task. Delete the file. If the file is occupied by the explorer.exe process, then before canceling the task in the task manager, run the command line as an administrator and, after canceling the task, use the command del full_path_to_file in the command line to delete it.

To return to the standard desktop view after this, you need to run explorer.exe again; to do this, in the task manager, select “File” - “New task” - “explorer.exe”.

Learn more about Windows Task Manager

Removing 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, system recovery disk, or Windows bootable USB flash drive. When using LiveCD in any of its variants, you can use either the standard Windows graphical interface (for example, in BartPE) and Linux (Ubuntu), or command line tools. Please note that when booting from such a drive, the computer's hard drives may appear under different letters. To ensure that you are deleting a file from the correct drive, you can use the dir c: command (this example will display a list of folders on the C drive).

When 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 already 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 installation program. Also, as in the previous case, pay attention to possible changes in drive letters.

Using DeadLock to Unlock and Delete Files

Since the Unlocker program discussed below, even from the official website, has recently (2016) begun 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 it didn't work in my tests).
The file is already in use. Close the file and try again.
The file is already in use. Close the file and try again.
So, if when deleting a file you see a message 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 click - unlock it (Unlock) and remove it (Remove). You can also move the file.
The file is already in use. Close the file and try again.
The file is already in use. Close the file and try again.
The program, although in English (perhaps a Russian translation will appear soon), is very easy to use. The disadvantage (and for some, perhaps an advantage) is that, unlike Unlocker, it does not add the action of unlocking a file to the Explorer context menu. You can download DeadLock from the official website  http://codedead.com/?page_id=822

Free Unlocker to unlock files that won't be deleted

The Unlocker program is probably the most popular way to delete files that are used by a particular process. The reasons for this are simple: it is free, it does its job properly, and 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 the file that is not being deleted and select “Unlocker” from the context menu. If you are using the portable version of the program, which is also available for download, launch the program and a window will open to select the file or folder you want to delete.

The essence of the program is the same as in the first described method - unloading from memory the processes that are occupied by the file. The main advantages over the first method are that using the Unlocker program it is easier to delete a file and, moreover, it can find and terminate a process that is hidden from the eyes of users, that is, not viewable through the task manager.

Update 2017: Another method, judging by the reviews, works successfully, was proposed in the comments by the author Tokha IT specialist: install and open the 7-Zip archiver (free, it also works as a file manager) and rename the file in it, which is not deleted. After this, the removal is successful.

Why is the file or folder not being deleted?

Some background information from the Microsoft site if anyone is interested. Although, the information is quite scarce. May also be useful: How to clean your disk of unnecessary files .

What may be preventing you from deleting a file or folder?

If you don't have the necessary system rights to change a file or folder, you can't delete it. If you didn't create the file, then chances are you can't delete it. The reason may also be settings made by the computer administrator.

Also, a file or folder containing it cannot be deleted if the file is currently open in the program. You can try closing all programs and try again.

Why when I try to delete a file does Windows say the file is in use?

This error message means that the file is being used by the program. Thus, you need to find the 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 online, the file may be currently in use by another user.

After deleting all files, an empty folder remains

In this case, try closing all open programs or restarting the computer, and then deleting the folder.