Recovery ofremoved files

Clayton Cramer cramer at optilink.UUCP
Tue Apr 26 09:01:35 AEST 1988


> From article <367 at axis.fr>, by inra at axis.fr (Inst. Natl. Rech. Agronomique):
> > 
> > After rm command is it possible to recover removed files
> 
> Believe it or not, but way back in the dim and distant past, a guru I
> knew at university had an unrm program (from what I could gather, it knew
> the nature of the freeblock list, and it looked at where the returned blocks
> were put, and then wrote their contents to a different file structure.
> Admittedly this was done under UNIX V6 from bell labs - whether the idea is
> portable to BSD or System 5, I have no idea.
> 

Here's my solution.  (Not elegant, but worth considering).  Put the 
following csh script in /usr/local/bin/del.

======================================================================
#   /bin/csh
foreach file ($argv)
mv $file /tmp/$USER/$file:t
end
======================================================================

and a line in your /usr/lib/crontab file to delete files more than three
days old from /tmp/$USER.  (You generally notice that a file you've deleted
needs undeleting within about ten seconds of doing an rm).

Why not call the script rm, so it's transparent to the user?  Well, then
you have to handle all the options on rm, because every program and shell
script that uses rm will be trying to run your program, not /bin/rm.

Of course, you could always handle the problem by making the above script
an alias instead.

Clayton E. Cramer



More information about the Comp.unix.wizards mailing list