Page 1 of 1

Use "RD /s" instead of deleting files individually

Posted: 2007-10-03, 04:38 UTC
by angussf
When you delete an entire directory, Total Commander deletes each file individually. This can cause problems if there are infected files in the directory as your real-time virus-shield will prevent the file from being deleted as TC opens the file to delete it. At least that's what happened to me today when I was cleaning up a directory that had some trojans in it.

I was able to open a CMD prompt (Windows XP Pro SP2), CD to the parent, and then use "RD /S infected-directory" to delete the entire tree with no problemsso this tells me the files were only locked when TC tried to delete them. If TC could use the "RD/q/s" logic instead of using whatever it does now, especially when you press [Shift-Del] to delete-bypassing-the-recycle-bin, this IMHO would be a Good Thing.

Posted: 2007-10-03, 07:53 UTC
by SanskritFritz
You can use the Explorer method for deleting, I dont know if that is sufficient. Just select Delete from the context menu of the folder.
This can cause problems if there are infected files in the directory
Infected files can cause many more problems than that ;-) I dont think you should play around with TC if you have an infection. Use a decent Live CD instead like Knoppix.

Posted: 2007-10-04, 16:01 UTC
by ghisler(Author)
I don't see how RD could delete an entire tree without deleting all files individually. If it just removed the link to the directory, then the disk space allocated for the files would remain allocated, resulting in lost chains (which only scandisk/checkdisk could free)...

Therefore I can just guess that your virus scanner is actively ignoring the RD command to make it faster...

Posted: 2007-10-08, 21:04 UTC
by angussf
ghisler(Author) wrote:I don't see how RD could delete an entire tree without deleting all files individually. If it just removed the link to the directory, then the disk space allocated for the files would remain allocated, resulting in lost chains (which only scandisk/checkdisk could free)...

Therefore I can just guess that your virus scanner is actively ignoring the RD command to make it faster...
It is my understanding that what RD does is to recursively process its way through the FAT (or NTFS) freeing up the occupied sectors without opening the files. It doesn't leave any orphaned allocated chains.

Microsoft Windows XP - Rmdir (rd)
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/rmdir.mspx

Apparently TC must open the files to delete them or my AV wouldn't yap.