home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / unix / question / 15257 < prev    next >
Encoding:
Internet Message Format  |  1993-01-07  |  1.3 KB

  1. Path: sparky!uunet!noc.near.net!hri.com!enterpoop.mit.edu!eru.mt.luth.se!lunic!sunic!ugle.unit.no!news.uit.no!mack.uit.no!edvard
  2. From: edvard@mack.uit.no (Oyvind Edvardsen)
  3. Newsgroups: comp.unix.questions
  4. Subject: Re: Undelete
  5. Message-ID: <1993Jan7.125307.17829@news.uit.no>
  6. Date: 7 Jan 93 12:53:07 GMT
  7. Sender: news@news.uit.no (USENET News System)
  8. Organization: University of Tromsoe
  9. Lines: 23
  10.  
  11.  
  12. One way of implementing sort of undelete under UNIX is to redefine the rm
  13. command. This has been covered by the FAQ. Here is a slightly different 
  14. method, also for csh(1). Insert the following into e.g. .login:
  15. alias rm 'mv -f \!* $TRASH'
  16.  
  17. You need also to define the TRASH variable as a directory to put the
  18. 'removed' files in. 
  19.  
  20. In your .logout you can specify something like:
  21. find $TRASH \( -mtime +2 -o -size +10000 \( -type f \) \) -exec /bin/rm -f {} \
  22.  
  23. One problem with this approach is that lots of people use workstations, thus
  24. logging out is not very frequent, and the TRASH directory may be pretty full
  25. after a while. Manual trash removal may be one solution, an other may be to 
  26. use cron to run a find as above.
  27.  
  28. Use /bin/rm instead of rm to by-pass the 'undelete' system. If you need to
  29. get back deleted (with redefined rm) files, get them from the TRASH
  30. directory.
  31.  
  32. -oed.
  33.  
  34.