Salome HOME
Join modifications from branch BR_JYP
[tools/hxx2salome.git] / rfind
1 #! /bin/sh
2
3 #
4 # Usage : rfind dir suffix ...
5
6 # find all files *suffix in dir in a recursive way
7 # different of the usual command find ...
8 #
9
10 if test $# != 2 ; then
11     echo "Usage : $0 dir suffix"
12     exit
13 fi
14
15 local_find() {
16     # if the first argument is not a directory, returns
17     if test ! -d $1 ; then 
18         # echo "$1 is not a directory"
19         return 
20     fi
21     # dont look in the CVS directories
22     # dont look in the autom4te* directories
23     case "$1" in
24         */CVS) return ;;
25         */autom4te*) return ;;
26         *) ;;
27     esac
28     # for each regular file contained in the directory
29     # test if it's a *"$2" file
30     for i in $1/*
31     do
32         if test -f $i ; then
33             case `basename $i` in 
34                 *$2) echo "     "$i ;;
35                 *) ;;
36             esac
37         fi
38     done
39     # for each subdirectory of the first argument, proceeds recursively
40     for i in $1/*
41     do
42         local_find $i $2
43     done
44 }
45
46 local_find $1 $2