Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I force the deletion of locked files in C/C++?

Tags:

c++

c

How do I programmatically force the deletion of files that are locked by the operating system or any other program with C/C++? The functionality should be similar to the software "Unlocker" at http://ccollomb.free.fr/unlocker.

like image 949
alrashedf Avatar asked Oct 18 '08 19:10

alrashedf


People also ask

How do you force delete a locked file?

Open the Start menu, then the File Explorer and find the formerly locked file. Remove the file. Click the previously locked file, then the “Home” tab, and “Delete” in the toolbar. Or, you may select the file by clicking on it and then pressing the “Delete” key.

How do I delete a file that Cannot be deleted?

Use Shift + Delete to Force Delete File/Folder. You can select the target file or folder and press Shift + Delete keyboard shortcut to delete the file/folder permanently. This file deletion method won't pass the Recycle Bin.

How do you force delete a file even if it is open?

In the command window, type the DEL /F file name command and press Enter to force delete the file that is in use.

How do I delete a file without permission?

Open Task Manager by pressing Ctrl + Shift + Esc key. In there, find the process or program that is using the file. Right-click on it and choose End task from the to close the program. Once closed, go ahead and see if you're able to delete the file or folder.


1 Answers

Look this sample.

like image 164
Christian C. Salvadó Avatar answered Oct 09 '22 05:10

Christian C. Salvadó