Force deleting files

Durum
Üzgünüz bu konu cevaplar için kapatılmıştır...
scouting
Onaylı Üye
Katılım
26 Haz 2020
Mesajlar
76
Çözümler
2
Tepki puanı
6
Ödüller
5
Yaş
25
5 HİZMET YILI
I'm working on a python project, and I don't really know how to force a file that being used by a program, is there any possible way?
 
Onaylı Üye
Katılım
9 Nis 2019
Mesajlar
50
Tepki puanı
0
Ödüller
4
Yaş
26
7 HİZMET YILI
This can be done through any third-party software. And possibly via the command line. I also faced this problem and I have to get through one program(I don't remember the name)
 
Seçkin Üye
Katılım
6 Haz 2020
Mesajlar
298
Çözümler
2
Tepki puanı
31
Ödüller
2
Yaş
26
5 HİZMET YILI

1. Close the Program​

Let's start with the obvious. Did you just open the file and not close it? If the file is closed, but the program is still running, close it too, then try again.

2. Reboot your computer​

While rebooting is inconvenient, it requires zero skills or fiddling with stuff like the Task Manager or third party tools. Rebooting also clears your RAM and possibly fixes other nuisances in one go. So try this if you can't be bothered to look into the cause.

3. End the Application via the Task Manager​

The reason rebooting helps is because the system will start from scratch and---among other things---all processes currently running in the Task Manager will be closed. Instead of rebooting, you can also try to manually end the process or application that holds your file hostage. This is the most successful method to fix the "file is open in another program" error.

Click Ctrl + Shift + ESC to open the Task Manager. Alternatively, you can right-click the Taskbar or click Ctrl + Alt + Del anywhere in Windows and select Task Manager. If you see the compact Windows 1o version, click More details and make sure you're in the Processes tab. Now browse for the application that you used to open the "file in use". For example, if you were viewing a document, look for Word.

Once you find the process, select it and click End task in the bottom right. This will close all instances of the program. If you cannot seem to find the process, have you tried rebooting, yet?

4. Change File Explorer Process Settings​

By default, File Explorer launches all its windows in a single process (explorer.exe). It could be, however, that your settings force File Explorer to launch separate processes, which could cause a conflict between different processes.

Press Windows + E to open File Explorer. Go to View > Options > Change folder and search options.

In the Folder Options window, switch to the View tab and find the Launch folder windows in a separate process option. Make sure it's not checked. Click Apply to save any changes.

If the option was unchecked in the first place, you could try if checking it solves your issue.

5. Disable the File Explorer Preview Pane​

Previews in the File Explorer can cause conflicts like the "file is open in another program" error.

Press Windows + E, switch to the View tab, and press Alt + P to close the preview pane. The screenshot below shows an open preview pane on the right.

After closing the preview pane, try the operation again and see whether the "file in use" error has disappeared.

6. Force Delete the File in Use via the Command Prompt​

You can bypass the File Explorer and force delete the file using the command prompt.

First, we need to track down the file path directory in File Explorer. Press Windows + E to open file explorer, locate the affected file, and copy the file path.
Now press Windows + S, search for Command Prompt, right-click the respective result, and select Run as administrator. To navigate to the file directory of your file in use, enter cd [directory path you copied] and hit Enter.

Before we can proceed and force delete the file in use, we have to temporarily kill the File Explorer process. This will cause your Taskbar, wallpaper, and open folders to disappear. But don't worry, you can restart File Explorer and we'll show you how below.

To close File Explorer, press Ctrl + Shift + ESC, find Windows Explorer, right-click the process, and select End task.

Return to the Command Prompt. If you lost the window, press Alt + Tab to jump to it.

Enter this command to delete the file, replacing everything between the quotes with your actual file name:

del "File in Use.doc"

To restart the File Manager, open the Task Manager (Ctrl + Shift + ESC), click File > Run new task, enter explorer.exe, and click OK. This should restore your desktop to its usual appearance.
 
Moderatörün son düzenlenenleri:
Uzman Üye
Katılım
21 Şub 2021
Mesajlar
224
Çözümler
5
Tepki puanı
10
Ödüller
3
Yaş
34
5 HİZMET YILI
You can smash it with anti-virus software
 
Onaylı Üye
Katılım
24 Mar 2021
Mesajlar
51
Tepki puanı
3
Yaş
25
5 HİZMET YILI
I belive you just use os.remove, but I haven't messed with python in awhile. Used it to auto delete my bots logs.
 
Seçkin Üye
Katılım
25 May 2020
Mesajlar
312
Çözümler
2
Tepki puanı
11
Ödüller
8
Yaş
38
6 HİZMET YILI
I know there is a command for it but I can't recall it at the moment, but you can just restart your pc and you should be able to delete it after.
 
Onaylı Üye
Katılım
23 May 2021
Mesajlar
53
Tepki puanı
2
Yaş
35
5 HİZMET YILI
use os library,it provides u some method where u can perform force operation on files
 
a simple Russian man who helps people
Uzman Üye
Katılım
16 Ağu 2020
Mesajlar
195
Çözümler
2
Tepki puanı
8
Ödüller
5
Yaş
26
5 HİZMET YILI
well to make it so that it can interact with the code but how can you find it on the Internet
 
Süper Üye
Katılım
25 Eki 2019
Mesajlar
647
Çözümler
11
Tepki puanı
41
Ödüller
6
Yaş
27
6 HİZMET YILI
Use os.remove() function .
 
Durum
Üzgünüz bu konu cevaplar için kapatılmıştır...
Üst