Salome HOME
63b68fa6e07f17600af14f9360fee73c77915da4
[modules/yacs.git] / src / wrappergen / bin / Cpp_Template__SRC / rfind
1 #! /bin/sh
2 # Copyright (C) 2006-2023  CEA, EDF
3 #
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License, or (at your option) any later version.
8 #
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 # Lesser General Public License for more details.
13 #
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 #
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #
20
21 #
22 # Usage : rfind dir suffix ...
23
24 # find all files *suffix in dir in a recursive way
25 # different of the usual command find ...
26 #
27
28 if test $# != 2 ; then
29     echo "Usage : $0 dir suffix"
30     exit
31 fi
32
33 local_find() {
34     # if the first argument is not a directory, returns
35     if test ! -d $1 ; then 
36         # echo "$1 is not a directory"
37         return 
38     fi
39     # dont look in the CVS directories
40     # dont look in the autom4te* directories
41     case "$1" in
42         */CVS) return ;;
43         */autom4te*) return ;;
44         *) ;;
45     esac
46     # for each regular file contained in the directory
47     # test if it's a *"$2" file
48     for i in $1/*
49     do
50         if test -f $i ; then
51             case `basename $i` in 
52                 *$2) echo "     "$i ;;
53                 *) ;;
54             esac
55         fi
56     done
57     # for each subdirectory of the first argument, proceeds recursively
58     for i in $1/*
59     do
60         local_find $i $2
61     done
62 }
63
64 local_find $1 $2