You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by "David M. Lee" <le...@yahoo.com> on 2006/09/28 14:30:50 UTC

wcfind

I've found wcgrep so useful, I've implemented a similar script for find.

I hope someone else will also find this useful.  I wouldn't mind if someone
put it in the Subversion contrib directory.

Enjoy!
dave
<><

#!/bin/sh

# Copyright 2006 David M. Lee, II <le...@yahoo.com>
# Licensed under terms subversion ships under or GPLv2.

# Inspired by wcgrep, useful for running find within a working copy.
# Should behave exactly as find does, except that this ignores any 
# .svn directories (along with their contents).
#
# WCFIND_FIND  Controls what command is used for the 'find' command.
#              Defaults to 'find'

WCFIND_FIND=${WCFIND_FIND:-find}

#
# Separate the path arguments from the expression.
# Use an array so paths with spaces can be passed to find as a 
# single word.
#
while test $# -gt 0; do
    if test "${1:0:1}" = "-"; then
	# we found an expression, no more paths
	break;
    elif test "$1" = "("; then
	# parenthesis are expressions
	break;
    else
	# collect the path into the path array
	pathargs=("${pathargs[@]}" "$1")
	shift 1
    fi
done

# '-true' prevents errors in case no expression is given
# '-not -name .svn' removes .svn from the implicit -print

"$WCFIND_FIND" "${pathargs[@]}" \
    "(" -name .svn -prune -o "(" -true "$@" ")" ")" -not -name .svn


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org