]> SALOME platform Git repositories - modules/yacs.git/blob - rfind
Salome HOME
mergefrom branch BR_V511_PR tag mergeto_trunk_03feb09
[modules/yacs.git] / rfind
1 #! /bin/sh
2 #  Copyright (C) 2006-2008  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.
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