Salome HOME
65ab46b6ed43c2ae323d7d51496f4d488d9ce176
[modules/yacs.git] / src / wrappergen / src / HXX2SALOME_GENERIC_CLASS_NAME_SRC / rfind
1 #! /bin/sh
2 # Copyright (C) 2006-2023  CEA/DEN, EDF R&D
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 # Author : Erwan ADAM (CEA)
21 # --
22
23 #
24 # Usage : rfind dir suffix ...
25
26 # find all files *suffix in dir in a recursive way
27 # different of the usual command find ...
28 #
29
30 if test $# != 2 ; then
31     echo "Usage : $0 dir suffix"
32     exit
33 fi
34
35 local_find() {
36     # if the first argument is not a directory, returns
37     if test ! -d $1 ; then 
38         # echo "$1 is not a directory"
39         return 
40     fi
41     # dont look in the CVS directories
42     # dont look in the autom4te* directories
43     case "$1" in
44         */CVS) return ;;
45         */autom4te*) return ;;
46         */*_ROOT) return ;;
47         */*_SRC) return ;;
48         *) ;;
49     esac
50     # for each regular file contained in the directory
51     # test if it's a *"$2" file
52     for i in $1/*
53     do
54         if test -f $i ; then
55             case `basename $i` in 
56                 *$2) echo "     "$i ;;
57                 *) ;;
58             esac
59         fi
60     done
61     # for each subdirectory of the first argument, proceeds recursively
62     for i in $1/*
63     do
64         local_find $i $2
65     done
66 }
67
68 local_find $1 $2