[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

wcfind

From: David M. Lee <leedm777_at_yahoo.com>
Date: 2006-09-28 16:30:50 CEST

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 <leedm777@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
Received on Fri Sep 29 05:31:39 2006

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.