[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: easy .deps rm in cvs
From:       hpj.lisa () t-online ! de (Hans-Peter Jansen)
Date:       1999-02-24 13:36:01
[Download RAW message or body]

Timothy Whitfield wrote:
> 
> I know everyone probably knew about this but me, but just in case there is
> any other user out there who gets irritated by having to remove .deps
> directories after re-cvs'ing.  Try this:
> 
> find /usr/src/kde -name .deps -exec rm -fr {} \;
> 
> Of course, change /usr/src/kde to your kde source directory.
> 
> Timothy

As I'm very lazy, I'm using something like this:

rm -r `ff .deps`

with this in /usr/local/bin:
(intentionally avoided perl, feedback welcomed)
["ff" (text/plain)]

#! /bin/sh
#(@)ff (c) by h.p.jansen, LISA GmbH, Berlin
# standard disclaimer: use at your own risk, and be happy
# please send bugfixes/improvements to hpj.lisa@t-online.de
#(@)last change: 1998/11/20

arg0=`basename $0`
verbose=0
files="*"
path="."
action=
type=
option=

function usage {
	echo "usage: $arg0 [-v][-f][-d][-o findoption][-l | -a action][--] filepattern | \
path/filepattern | path filepatterns";  echo "   -v: verbose mode (-vv prints exact \
find command, instead)"  echo "   -f: find files only"
	echo "   -d: find dirs only"
	echo "   -o: any find option (e.g. ff -o '-mount -maxdepth 2' ."
	echo "   -l: long listing"
	echo "   -a: what to do with files/dirs" 
	echo "   --: use to separate options from arguments"
	echo "       $arg0 helps you to find files/dirs, as it acts as a frontend to find"
	echo "       if you want to search for multiple filepatterns, precede a path \
argument"   echo "       don't forget to escape shell meta characters"
	echo "       e.g.: ff . .\*.bak .\*~"
	echo "       default path: $path; default filepattern: $files;"
	echo "       unlike name implies, $arg0 finds directories, too"
	exit 1;
}

if [ $# -eq 0 ]; then
	usage 1>&2;
fi

while [ $# -ge 0 ]; do
	case $1 in
		-vv)	verbose=2; shift;;
		-v)		verbose=1; shift;;
		-f)		type="-type f"; shift;;
		-d)		type="-type d"; shift;;
		-o)		option="$2"; shift; shift;;
		-l)		action="ls -ld"; shift;;
		-a)		action="$2"; shift; shift;;
		-*)		usage 1>&2;;
		--)		shift; break;;
		*)		break;;
	esac;
done

if [ $# -ge 2 ]; then
	path="$1"
	shift
	files="$1"
	shift
	if [ ! -z "$*" ]; then
		for i in "$*"; do
			files="$files -o -name $i"
		done
	fi
elif [ $# -eq 1 ]; then
	if [ -d "$1" ]; then
		path="$1"
	else
		files=`basename "$1"`
		path=`dirname "$1"`
	fi
fi

if [ "$verbose" -eq 1 ]; then
	if [ ! -z "$action" ]; then
		echo -n "execute \"$action\" on \"$files\""
	else
		echo -n "$arg0 \"$files\""
	fi
	if [ ! -z "$type" ]; then
		echo -n " of \"$type\""
	fi
	echo -n " in \"$path\""
	if [ ! -z "$option" ]; then
		echo -n " with option(s) \"$option\""
	fi
	echo ""
elif [ "$verbose" -ge 2 ]; then
	if [ -z "$action" ]; then
		echo find $path $type $option \( -name $files \) -print
	else
		echo "find $path $type $option \( -name $files \) -exec $action '{}' \;"
	fi
fi

if [ -z "$action" ]; then
	find "$path" $type $option \( -name "$files" \) -print
else
	find "$path" $type $option \( -name "$files" \) -exec $action '{}' \;
fi



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic