]> SALOME platform Git repositories - modules/yacs.git/blob - rfind
Salome HOME
PR: first version from Antony GEAY, with directory restructuration
[modules/yacs.git] / rfind
1 #! /bin/sh
2 # --
3 # Copyright (C) CEA, EDF
4 # Author : Erwan ADAM (CEA)
5 # --
6
7 #
8 # Usage : rfind dir suffix ...
9
10 # find all files *suffix in dir in a recursive way
11 # different of the usual command find ...
12 #
13
14 if test $# != 2 ; then
15     echo "Usage : $0 dir suffix"
16     exit
17 fi
18
19 local_find() {
20     # if the first argument is not a directory, returns
21     if test ! -d $1 ; then 
22         # echo "$1 is not a directory"
23         return 
24     fi
25     # dont look in the CVS directories
26     # dont look in the autom4te* directories
27     case "$1" in
28         */CVS) return ;;
29         */autom4te*) return ;;
30         */*_ROOT) return ;;
31         */*_SRC) return ;;
32         *) ;;
33     esac
34     # for each regular file contained in the directory
35     # test if it's a *"$2" file
36     for i in $1/*
37     do
38         if test -f $i ; then
39             case `basename $i` in 
40                 *$2) echo "     "$i ;;
41                 *) ;;
42             esac
43         fi
44     done
45     # for each subdirectory of the first argument, proceeds recursively
46     for i in $1/*
47     do
48         local_find $i $2
49     done
50 }
51
52 local_find $1 $2