Deleting Files

We have a safety-net to the default program that is used to delete files.

Now when you delete a file called, say, fermat.tex, it is saved with a new unique filename, usually something like .Zap.0.fermat.tex in the directory that the original file existed. You can then easily recover it until around 5:00 AM, when the computer will automatically delete the previous day's zapped files.

The main point is that now you can change your mind about a file (or directory) that you have deleted, provided that you do so roughly on the same day as the delete.

As an example with more detail, suppose you have deleted a file named fermat.tex from your account, using the Unix rm command. A half hour later, suppose you wish that you had not deleted the file.

Under the new system, you didn't really remove that file (yet), you only changed its name. It is now called .Zap.0.fermat.tex or something close to that, and it is still living in your _same_ directory. Note carefully that since the new file name begins with a ., you will not be able to see the renamed file in a normal directory listing such as you would get with an ls command. It is an invisible file.

If you want to remove a directory along with all of its files and subdirectories, it is simplest to use the Unix command

	rm  -r  directoryname
("Zap" understand this also).

If you would like to un-delete the file (or directory), you should first get a Unix prompt and type

	ls -a
to get a directory listing in which the invisible files can be seen (or
	ls -al .Zap* 
for a more detailed listing just of the Zapped files). In that listing, locate the renamed file that you want to recover, and note its new name. Then you need only to rename it (again) back to its original name. This can be done with a mv command, for example,
	mv  .Zap.0.fermat.tex  fermat.tex
[mv is the Unix rename command. Think of the word move]. You can also rename the file with the CDE file manager or many other related utilities such as mc, which is like the "Norton Commander" on a PC].

Files and directories "deleted" with this new procedure still count as part of your hard-disk quota until they are actually deleted by the system around 5 AM. If you really want to delete a file immediately, then use the following command:

	\rm -i  fermat.tex

If for some reason you do not want to use this "Zap" safety-net, then in the .login file in your home directory, change the line:

        alias  rm  rmz -iz
to
        alias  rm  rm -i
[or the similar line if you use a shell other than csh or tcsh].

The man page for rmz provides more technical information regarding this process for interested users.

Warning: This "Zap" safety-net does not apply to files that are deleted by programs. For instance, if you are using elm and delete an email message or an use editor such as Emacs, Nedit, Pico, and delete something, those files are not saved by this since these programs will continue to use their own internal procedures for deleting files.