openfoam/bin/tools/findEmptyMake
2023-05-10 18:23:13 +02:00

72 lines
1.8 KiB
Bash
Executable File

#!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | www.openfoam.com
# \\/ M anipulation |
#-------------------------------------------------------------------------------
# Copyright (C) 2011-2016 OpenFOAM Foundation
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# Script
# findEmptyMake
#
# Description
# Usage: findEmptyMake [dir1 .. dirN]
#
# Find Make/ directories without a 'files' or 'options' file.
# This can occur when a directory has been moved.
#------------------------------------------------------------------------------
usage() {
exec 1>&2
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE
Usage: ${0##*/} [OPTION] [dir1 .. dirN]
Find Make/ directories without a 'files' or 'options' file.
This can occur when a directory has been moved.
USAGE
exit 1
}
# parse options
while [ "$#" -gt 0 ]
do
case "$1" in
-h | -help*)
usage
;;
-*)
usage "unknown option: '$*'"
;;
*)
break
;;
esac
done
# default is the current directory
[ "$#" -gt 0 ] || set -- .
for checkDir
do
if [ -d "$checkDir" ]
then
echo "searching: $checkDir" 1>&2
else
echo "skipping non-dir: $checkDir" 1>&2
continue
fi
find $checkDir -depth -name Make -type d -print | while read makeDir
do
[ -r "$makeDir/files" -a -r "$makeDir/options" ] || echo "$makeDir"
done
done
#------------------------------------------------------------------------------