Sometimes deleting a file is not enough. Sometimes you don't want people reading your own mail on your old computer, but you can't low level format it just to be sure that it's actually, physically deleted. How do you do that?

The theory: deleting a file on Windows

When you delete a file on Windows by pressing the DEL key, the file is not actually removed from your hard disk but it's copied (not exactly, but kind of) to a different location called the Recycle Bin. This makes it possible for you to undelete the file at a later moment just by dragging the file from the Recycle Bin to some other point of the file system.

When you perform an "Empty recycle bin" action, the file is removed from the recycle bin area and the file is not accessible anymore to the file system. This is a "deleted file" on Windows.

What does not happen at this very moment is that the file system actually "cleans" the file from the hard disk. The space taken by the now deleted file will be added to a list of available disk space, and when (and if) the file system will ever need that disk space, data inside it will be actually overwritten.

Meanwhile, there is a number of rescue utilities that - by using this misunderstanding - let people easily recover files deleted by unknowing users. Our point now is to make it hard for people using such a software to extract files from our computers.

The practice: overwriting deleted files

From what we have learned so far, we understand that we need to make sure the file system has a need for space in order for our old file(s) to be actually overwritten.

First, you'll have to empty your browser cache and empty your recycle bin. Deleting the contents of your TEMP directory might also help, so that you maximise the amount of free space on your system.

Then, the easiest way to do it is to fill all unused disk space on your machine with something dull and boring. Any data CD will do - a linux distro, a shareware CD, all of this stuff may be copied over and over again on your hard disk until it's all filled up like an egg. When you have nearly zero bytes free, you simply delete it all and empty the recycle bin. Whatever you had on your hard disk should be now gone forever.

As an alternative, if you have Perl running on your machine, this simple one-liner will try and fill all available drive space by growing a file called 'fr.txt':

perl -e"open F, '>fr.txt'; while() { print F chr rand( 20 ) + 65; }"
When you have nearly zero bytes free, just interrupt it and delete fr.txt. Now all of your files should be dead and gone.