From f8cae3f43c939979732ff4e467ee97b8cdb7bf98 Mon Sep 17 00:00:00 2001 From: Mark Olesen <Mark.Olesen@Germany> Date: Tue, 22 Feb 2011 19:11:51 +0100 Subject: [PATCH] ENH: add cleanCodeStream to tools/CleanFunctions --- bin/tools/CleanFunctions | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/bin/tools/CleanFunctions b/bin/tools/CleanFunctions index 11185647041..458fdc026e6 100644 --- a/bin/tools/CleanFunctions +++ b/bin/tools/CleanFunctions @@ -30,15 +30,14 @@ #cleanTimeDirectories() #{ -# echo "Cleaning $case case of $application application" -# TIME_DIRS=`foamInfoExec . $1 -times | sed '1,/constant/d'` -# for T in $TIME_DIRS +# echo "Cleaning $PWD case" +# for time in $(foamInfoExec -times) # do -# if [ $T != "0" ] -# then -# echo "Deleting directory $T" -# rm -rf ${T} > /dev/null 2>&1 -# fi +# # keep 0 and constant directories +# [ "$time" = "0" -o "$time" = constant ] || { +# echo "Deleting directory $time" +# rm -rf $time > /dev/null 2>&1 +# } # done # rm -rf {log,log.*,log-*,logSummary.*,.fxLock,*.xml,ParaView*,paraFoam*,*.OpenFOAM} > /dev/null 2>&1 #} @@ -56,15 +55,32 @@ cleanTimeDirectories() rm -rf ./[1-9]* ./-[1-9]* ./log ./log.* ./log-* ./logSummary.* ./.fxLock ./*.xml ./ParaView* ./paraFoam* ./*.OpenFOAM > /dev/null 2>&1 } + +# +# Remove codeStream subdirectory if it looks appropriate +# +cleanCodeStream() +{ + if [ -d system -a -d codeStream ] + then + rm -rf codeStream > /dev/null 2>&1 + fi +} + + cleanCase() { cleanTimeDirectories + cleanCodeStream + rm -rf processor* > /dev/null 2>&1 rm -rf probes* > /dev/null 2>&1 rm -rf forces* > /dev/null 2>&1 rm -rf sets > /dev/null 2>&1 rm -rf system/machines > /dev/null 2>&1 - if [ -d "constant/polyMesh" ]; then + + if [ -d constant/polyMesh ] + then (cd constant/polyMesh && \ rm -rf \ allOwner* cell* face* meshModifiers* \ @@ -94,7 +110,7 @@ cleanCase() removeCase() { - echo "Removing $case case" + echo "Removing ${1:-unknown} case" rm -rf $1 } -- GitLab