It is easy to delete file or folder from a command line. It is easy to delete locked file or folder from a nice GUI tools like Unlocker.

But is there a way to delete locked file/folder from a command line? Is there any utility for that?

Update: yes, it is Windows :)

link|improve this question

75% accept rate
is this on windows? – Simon Sheehan Dec 12 '11 at 0:12
3  
@Simon: I'm guessing yes, since Unix-like systems allow deletion of open files. – grawity Dec 12 '11 at 0:43
Yes, sorry, forgot to mention this. Updated the question. – Alex Dec 12 '11 at 12:09
feedback

2 Answers

up vote 4 down vote accepted

Sysinternals Handle can list all open handles (to files and other objects), as well as close them. Run handle filename to list all matching handles, then handle -c id -p pid to close it. This is basically the same as what Unlocker does.

(Edit: Added forgotten -p option.)

link|improve this answer
Thanks, grawity, will try. – Alex Dec 12 '11 at 1:59
feedback

I don't know if it's possible to delete a locked file immediately, but BusyDelete will schedule the file for removal after a reboot.

BusyDelete will delete files even if they are busy. The file(s) you specify will be marked for deletion. Then the next time you reboot your system the Operating System will delete the file(s). For example BDEL ATL.DLL will delete the file during the next reboot.

There are quite a few other useful utilities there too.

link|improve this answer
Thank you for your reply. However, this is unfortunately, not suitable option as I need a tool like Unlocker, which can do this immediately. – Alex Dec 12 '11 at 0:09
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.