From 9e015293b2739fd034e0a517370e04af0ae21b76 Mon Sep 17 00:00:00 2001 From: Henry <Henry> Date: Fri, 8 May 2015 22:47:31 +0100 Subject: [PATCH] foamListTimes: Added '-rm' option to remove the selected time directories If -rm is specified with the -processor option the selected time directories are removed from all the processor directories. --- .../foamListTimes/foamListTimes.C | 39 ++++++++++++++++++- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/applications/utilities/postProcessing/miscellaneous/foamListTimes/foamListTimes.C b/applications/utilities/postProcessing/miscellaneous/foamListTimes/foamListTimes.C index 1cd84f1851c..8659f0205fd 100644 --- a/applications/utilities/postProcessing/miscellaneous/foamListTimes/foamListTimes.C +++ b/applications/utilities/postProcessing/miscellaneous/foamListTimes/foamListTimes.C @@ -31,6 +31,8 @@ Usage - foamListTimes [OPTION] + \param -rm \n + Remove selected time directories \param -processor \n List times from processor0/ directory @@ -56,6 +58,11 @@ int main(int argc, char *argv[]) "processor", "list times from processor0/ directory" ); + argList::addBoolOption + ( + "rm", + "remove selected time directories" + ); #include "setRootCase.H" label nProcs = 0; @@ -117,9 +124,37 @@ int main(int argc, char *argv[]) args ); - forAll(timeDirs, timeI) + if (args.optionFound("rm")) { - Info<< timeDirs[timeI].name() << endl; + if (args.optionFound("processor")) + { + for (label procI=0; procI<nProcs; procI++) + { + fileName procPath + ( + args.path()/(word("processor") + name(procI)) + ); + + forAll(timeDirs, timeI) + { + rmDir(procPath/timeDirs[timeI].name()); + } + } + } + else + { + forAll(timeDirs, timeI) + { + rmDir(args.path()/timeDirs[timeI].name()); + } + } + } + else + { + forAll(timeDirs, timeI) + { + Info<< timeDirs[timeI].name() << endl; + } } return 0; -- GitLab