#! /bin/sh # Copyright (C) 2006-2016 CEA/DEN, EDF R&D # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # # -- # Author : Erwan ADAM (CEA) # -- # # Usage : rfind dir suffix ... # # find all files *suffix in dir in a recursive way # different of the usual command find ... # if test $# != 2 ; then echo "Usage : $0 dir suffix" exit fi local_find() { # if the first argument is not a directory, returns if test ! -d $1 ; then # echo "$1 is not a directory" return fi # dont look in the CVS directories # dont look in the autom4te* directories case "$1" in */CVS) return ;; */autom4te*) return ;; */*_ROOT) return ;; */*_SRC) return ;; *) ;; esac # for each regular file contained in the directory # test if it's a *"$2" file for i in $1/* do if test -f $i ; then case `basename $i` in *$2) echo " "$i ;; *) ;; esac fi done # for each subdirectory of the first argument, proceeds recursively for i in $1/* do local_find $i $2 done } local_find $1 $2