2 #------------------------------------------------------------------------------
4 # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
6 # \\ / A nd | Copyright (C) 1991-2009 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 the
14 # Free Software Foundation; either version 2 of the License, or (at your
15 # 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, write to the Free Software Foundation,
24 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
30 # Usage: rmdepold [dir1 .. dirN]
32 # Remove *.dep files that are without a corresponding .C or .L file.
33 # This often occurs when a directory has been moved.
34 # - print questionable directory and the *.dep file
35 # - optionally remove empty directories
36 #------------------------------------------------------------------------------
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 # -----------------------------------------------------------------------------