muquit@garfield.ncat.edu (MUHAMMAD A. MUQUIT) (05/14/91)
The following shell script developed by Dr. E. Nzewi (Department of Civil Engineering, North Carolina A&T State University) is a good solution of accidental file and directory deletion. If you put the script in your .login file, it should work just fine. With Dr. Nzewi's permission, I am putting the script below. --------------------CUT HERE------------------------------- # Temporary dumping ground for removed files .. creation # and use .... ZAP == /tmp/$user # # first part checks whether ZAP # exists ... if it does great, if not, create the directory # ZAP directory is /tmp/yourlogin e.g. /tmp/m40 # /bin/test -d /tmp/$user set statuszap = $status if ($statuszap == '1') then rm -f /tmp/$user mkdir /tmp/$user endif # # aliases to enable ZAP = /tmp/$user usage .. # # rm -- moves files to temporary grave .. retrieve with "getzap" # rmdir -- to remove a directory .. move a whole directory to ZAP # del -- removes a file immediately from the disk ... does NOT # store in /tmp/$user temporarily. # getzapd -- get a directory from ZAP .. if it is still there # getzapf -- get a file from ZAP .. if it is still there # dumpzap -- delete ALL files in ZAP .. directory ZAP remains # lszap -- list files in ZAP # alias rm 'mv \!* /tmp/$user' alias rmdir 'cp -r \!* /tmp/$user; /bin/rm -r \!*' alias del 'echo DELETE COMPLETELY: Are you SURE\? ; /bin/rm -i \!*' alias getzapd 'cp -r /tmp/$user/\!* $cwd; /bin/rm -r /tmp/$user/\!*' alias getzapf 'mv /tmp/$user/\!* $cwd' alias dumpzap 'echo -n "Deletion of ZAP directory: sure? [y=yes, n=no:] " ; set ansdump = $<; if( $ansdump == 'y') /bin/rm -r /tmp/$user; if( $ansdump == 'y') mkdir /tmp/$user' alias lszap 'ls /tmp/$user ' ------------------------------CUT HERE------------------------------------- ******************************* Muhammad A. Muquit Graduate Student Department of Civil Engineering North Carolina A&T State University Greensboro, NC 27411 ******************************** e-mail address: nzewi@garfield.ncat.edu or muquit@garfield.ncat.edu