How can I undelete a file or directory?

Rich Caloggero rjc at MIT.EDU
Mon Jun 17 21:15:34 EDT 2002


SOmeone wrote:
One of the many bad habbits Windblows has taught people is that you can
delete any file you want and the recycle bin will almost always restore
it.Which means in the long run you never really deleted it because it eats
up space in a hidden folder on your hard drive.

Well, that's one of window's saving graces (one of the few). Ya sure, the
file isn't gone until you empty the recycle bin, but you can set the size of
the recycle bin to be, say, 5% of your drive, which means in the overall
scheme of things, it really isn't taking up that much space. If your down to
5% of your drive, then you'd better do some serious housecleaning, or get a
bigger drive. You don't know how many times the recycle bin has saved my
butt, not because I'm stupid and don't know what I'm doing, but because I'm
human and made a mistake.

About the best thing you can do on linux/unix in this regard is to write a
shell script that does some sort of recycle bin kind of hack. The easiest
one I've seen is to add some sort of character sequence to the file name,
like '#' to the name - something which is hard to get accidentally. The
number-sign '#' is a good choice because it is a shell comment character, so
to actually get it into a filename your typing takes a little forethought,
so its hard to do accidentally. In any case, deleting a file would just be a
rename to something like "\#$filename", where $filename is the file your
working with. Then, you undelete by renaming the file again. The files get
stored in their original directory, so you don't need to manage some sort of
database which remembers where the files came from - this quickly becomes a
hastle.

Hope this helps someone!

                    Rich

----- Original Message -----
From: "Thomas Ward" <slingshooter at valkyrie.net>
To: <speakup at braille.uwo.ca>
Sent: 15 June, 2002 1:49 PM
Subject: Re: How can I undelete a file or directory?


I guess it comes down to how bad you want the files. You see If you remove a
file under any Unix system it assumes you want to completely remove that
file and it does.
Of course, X has trashcan/recycle bin like utilities, but in this case they
won't help you because you weren't using X when you removed the files.
One of the many bad habbits Windblows has taught people is that you can
delete any file you want and the recycle bin will almost always restore
it.Which means in the long run you never really deleted it because it eats
up space in a hidden folder on your hard drive.









More information about the Speakup mailing list