mIRC Homepage
Posted By: westor Delete a file that is in use - 05/03/11 06:44 PM
Hello,

I wanna ask if there is any Windows command or with any .dll , .exe file that can i delete a file that is in use!

- Thanks!
Posted By: RoCk Re: Delete a file that is in use - 05/03/11 06:46 PM

Delete a file from within mIRC or in Windows?

Try this
http://unlocker.emptyloop.com/
Posted By: westor Re: Delete a file that is in use - 05/03/11 07:05 PM
I am looking for a command or utility that will work with no setup.
Posted By: Tomao Re: Delete a file that is in use - 06/03/11 07:18 PM
According to the help file:
Quote:
/remove [-b] <filename>

Deletes the specified file.

The -b switch deletes the file and moves it to the recycle bin.
If this is what you're looking for.... This command is mIRC specific.

* And you still haven't answered RoCk's question.
Quote:
Delete a file from within mIRC or in Windows?


Posted By: westor Re: Delete a file that is in use - 07/03/11 12:22 AM
I knew the mIRC command but if a file is in use the mIRC does not delete it and returns an error!
Posted By: Riamus2 Re: Delete a file that is in use - 07/03/11 02:35 AM
There *may* be a built-in Windows method to delete files that are in use (perhaps using COM), but I'm not sure. Normally, you have to use a third party utility or restart the computer if you aren't able to get the file out of use.
Posted By: Tomao Re: Delete a file that is in use - 07/03/11 07:12 AM
You can try this by entering the command via mIRC:
Code:
/run cmd /c del file.txt
Replace file.txt with the actual file name you wish to delete. This opens the window command prompt momentarily and executes the deletion of a file.
Posted By: argv0 Re: Delete a file that is in use - 08/03/11 10:09 AM
There's a "bug"(?) in older(?) versions of windows that allows you to rename a file that is in use and delete that. The file will continue to be in use, though.

If that doesn't work, you cannot delete a file that is in use, nor should you try. Stop using it, first, then delete it.

No builtin command work if the standard right click -> delete functionality in the Windows Explorer does not work. Windows gives you this message for a reason.
Posted By: Tomao Re: Delete a file that is in use - 08/03/11 10:51 AM
I read it here at this link:

http://www.cypherhackz.net/archives/2007/01/16/how-to-delete-in-use-file-in-windows/

(unless the person who wrote the claim is full of it) that you can force delete an in-use file through the command prompt. The demonstration is for xp but should work for vista and windows 7 the same way.
Posted By: Riamus2 Re: Delete a file that is in use - 08/03/11 11:16 AM
Yeah, that author is full of it. The del command isn't going to do anything (other than giving you an error) if you can't right click and delete the file. (Or if /remove doesn't work in mIRC)

The file has to be closed before deleting it. I believe third party utilities just find a way to close it. Perhaps they find out what program is using it and close that. I really don't know because I don't bother. I have just restarted the computer the few times I've had a file that was marked as being in-use.
Posted By: Horstl Re: Delete a file that is in use - 08/03/11 11:20 AM
A simple test (say, copy some audio file, play the file and try to delete while playing) will show that this won't work. As pointed out, you have to e.g. close the file handle first - and there's no simple command for the task, even though there are user-friendly tools for it (like the one RoCk linked to).
Posted By: Tomao Re: Delete a file that is in use - 08/03/11 07:26 PM
Thank you two for the reconfirmation.
Posted By: argv0 Re: Delete a file that is in use - 09/03/11 04:17 AM
The program probably uses the rename trick, which you can use in mIRC too:

Play some mp3 file foo.mp3
/rename foo.mp3 bar.mp3
/remove bar.mp3

If the rename works, the remove works. I couldn't do this in Win7, but I also couldn't rename it through explorer, which I remember being able to do in XP. IOW the bug may have been fixed.
Posted By: Tomao Re: Delete a file that is in use - 09/03/11 10:31 AM
Yes, that trick worked under Vista. I added the -b switch and it was removed to the recycle bin while the song was still playing.
© mIRC Discussion Forums