fixing rm *

Steven Bickel bickel at nprdc.arpa
Sat Nov 19 08:29:10 AEST 1988


# aliasing rm to this simple shell script should solve all rm problems
# providing you have some extra disk space and the rm_purge alias is executed
# regularly ie. in a .login file. It will currently purge all files from
# the removal directory after 21 days.

# remove script
num=0;
for i in $@
do
   if test -r $i 
   then
      chmod 777 $i;
      rm_dir="/usr/tmp/rmtmp/$i";
      echo "moved" $i $rm_dir ;
      mv $i $rm_dir;
      num=num+1;
   fi
done

alias rm_purge "find /usr/tmp/rmtmp/ -name '*' -print -atime +21 -exec rm -r '{}' \;"

          Steve Bickel                          bickel at nprdc.arpa
	  Systems Engineering Assoc.            (619) 553-9306
	  Naval Personel R & D Center.
 



More information about the Comp.unix.wizards mailing list