2 #---------------------------------*- sh -*-------------------------------------
4 # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
6 # \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
8 #------------------------------------------------------------------------------
10 # This file is part of OpenFOAM.
12 # OpenFOAM is free software: you can redistribute it and/or modify it
13 # under the terms of the GNU General Public License as published by
14 # the Free Software Foundation, either version 3 of the License, or
15 # (at your option) any later version.
17 # OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
18 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
19 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 # You should have received a copy of the GNU General Public License
23 # along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
29 # Usage: rmdepold [dir1 .. dirN]
31 # Remove *.dep files that are without a corresponding .C or .L file.
32 # This often occurs when a directory has been moved.
33 # - print questionable directory and the *.dep file
34 # - optionally remove empty directories
35 #------------------------------------------------------------------------------
37 while [ "$#" -ge 1 ]; do echo "$1"; shift; done
39 Usage: ${0##*/} [OPTION] [dir1 .. dirN]
41 -rmdir find and remove empty directories (recursively)
43 Remove *.dep files that are without a corresponding .C or .L file.
44 This often occurs when a directory has been moved.
45 - print questionable directory and file
46 - optionally remove empty directories
66 usage
"unknown option: '$*'"
74 # default is the current directory
75 [ "$#" -gt 0 ] ||
set -- .
81 echo "searching: $checkDir"
83 echo "skipping non-dir: $checkDir"
87 find $checkDir -name '*.dep' -print |
while read depFile
89 # check C++ and Flex files
90 if [ ! -r "${depFile%dep}C" -a ! -r "${depFile%dep}L" ];
93 rm -f $depFile 2>/dev
/null
100 # get subdirs ourselves so we can avoid particular directories
101 for dir
in $
(find $checkDir -mindepth 1 -maxdepth 1 -type d \
( -name .git
-prune -o -print \
) )
103 echo "check dir: $dir"
104 find $dir -depth -type d
-empty -exec rmdir {} \
; -print
108 # -----------------------------------------------------------------------------