File handling is done by your operating system. The important thing to
remember is that the OS does not delete files but rather it forgets that it
ever put a file there and considers that space to be free to use. If it uses
that space for something else then it overwrites the file that you had. If it
does not use that space then your file remains. Undelete programs scan the
free space on your hard drive looking for file headers and attempt to
recreate the files that have not been overwritten. Also note that the disk
does not discern between areas that have been previously uses and areas that
have not. Free space is free space and it will write anywhere in th efree
space. (This is a little bit simplified but you get the idea).