2 #------------------------------------------------------------------------------
4 # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
6 # \\ / A nd | Copyright (C) 2004-2011 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 #------------------------------------------------------------------------------
38 while [ "$#" -ge 1 ]; do echo "$1"; shift; done
40 Usage: ${0##*/} [OPTION] [dir1 .. dirN]
42 -rmdir find and remove empty directories (recursively)
44 Remove *.dep files that are without a corresponding .C or .L file.
45 This often occurs when a directory has been moved.
46 - print questionable directory and file
47 - optionally remove empty directories
67 usage
"unknown option: '$*'"
75 # default is the current directory
76 [ "$#" -gt 0 ] ||
set -- .
82 echo "searching: $checkDir"
84 echo "skipping non-dir: $checkDir"
88 find $checkDir -name '*.dep' -print |
while read depFile
90 # check C++ and Flex files
91 if [ ! -r "${depFile%dep}C" -a ! -r "${depFile%dep}L" ];
94 rm -f $depFile 2>/dev
/null
101 # get subdirs ourselves so we can avoid particular directories
102 for dir
in $
(find $checkDir -mindepth 1 -maxdepth 1 -type d \
( -name .git
-prune -o -print \
) )
104 echo "check dir: $dir"
105 find $dir -depth -type d
-empty -exec rmdir {} \
; -print
109 # -----------------------------------------------------------------------------