How do I "undelete" (restore) a file that has been deleted?

What happens if you accidently deleted something from your SEAS home directory? No need to worry, CETS has created backups for you. You can easily find them and restore then yourself from your SEAS home directory.

The Snapshot Directory

In a unix shell or Windows command prompt, cd from your home directory, into the directory '.snapshot'. This is a special directory that doesn't show up when you do 'ls' or 'dir'; it holds snapshots of your home directory made over the last couple of weeks. To get to it, type the following from your home directory:

cd .snapshot

Inside the .snapshot directory are directories named after the dates and times snapshots were taken. Pick one from just before you deleted your files and cd into it. You'll see your files as they were at that time. You can copy them back into your home directory from there. Please note: The snapshots do not count against your SEAS disk usage.

Accessing your snapshots via WS_FTP

You can access your snapshot directory using WS_FTP. Connection using these instructions, then add this in the address bar after your username:


If what you deleted is not in your Snapshot directory, don't worry, there is still hope! CETS creates a monthly archive to tapes. If your lost files are important and cannot be recreated easily, send mail to CETS and request that your files be restored. Be sure to tell us the name and location of the file, and the date and time when the file was destroyed. Our backup tapes are reused each month, so we may not be able to restore a file that was removed more than a month ago.

Restoring a file from backup takes a CETS staff person about an hour, and you will have to wait about one business day, or possibly more, before the file is restored. For this reason, we try to limit each person to two restore requests per week, and three restore requests per semester. For this reason, please do not ask us to restore a file that can be easily re-created. For example, if you accidentally delete a file that you have saved off the web, just download another copy from the web rather than asking for us to restore it. But, if you accidentally delete the only copy of your term paper, we will be happy to restore it for you if we can.

If you use the unix shell and want more information...

If you want more security than our backups provide, read on.

Someday, you are going to accidentally type something like "rm * .foo", and find you just deleted "*" instead of "*.foo". Consider it a rite of passage.

For all intents and purposes, when you delete a file with "rm" it is gone. Once you "rm" a file, the system totally forgets which blocks scattered around the disk comprised your file. Even worse, the blocks from the file you just deleted are going to be the first ones taken and scribbled upon when the system needs more disk space.

Your first reaction when you "rm" a file by mistake is why not make a shell alias or procedure which changes "rm" to move files into a trash bin rather than delete them? That way you can recover them if you make a mistake, and periodically clean out your trash bin. Two points: first, this is generally accepted as a *bad* idea. You will become dependent upon this behavior of "rm", and you will find yourself someday on a normal system where "rm" is really "rm", and you will get yourself in trouble. Second, you will eventually find that the hassle of dealing with the disk space and time involved in maintaining the trash bin, it might be easier just to be a bit more careful with "rm". For starters, you should look up the "-i" option to "rm" (as well as "cp" and "mv", which can also inadvertently overwrite your files) in your manual.

If you are still undaunted, you should check out the "rmz" command on Eniac (and the related commands "cpz" and "mvz"). Files "removed" by these commands are kept for about one week, and are then really removed.

Note: For information on logging into Eniac, please see "How Do I Log Into Eniac?"

© Computing and Educational Technology Services | Report a Problem | 215.898.4707