#!/bin/sh # # Delete backup files # # 'gfr' stands for Grim File Reaper. I got the name from the # jargon file. No doubt zillions of people have written scripts # that do just this, but this one's mine :) # # Copyright (C) 2000-2003 by Ricky Buchanan # # Last updated by rb on Tue Oct 21 07:55:25 EST 2003 # find=/usr/bin/find rm=/bin/rm if [ "$*" = "-r" ] ; then # recurse - the default for find but not for us args="" elif [ "$*xx" = "xx" ] ; then # don't recurse args="-maxdepth 1" elif [ "$*" = "-h" ] ; then echo "Usage: gfr [OPTION]" echo echo " -r Recurse into directories" echo " -h Display this screen" echo exit else echo "gfr: invalid option" echo "Try 'gfr -h' for more information." exit fi $find . \( -name '*.bak' -o -name '*~' -o -name '*.old' -o -name '.*.bak' -o -name '.*~' -o -name '.*.old' \) $args -exec $rm -v {} \; # # End. #