72const regExp matcher(
"processors?[0-9]+(_[0-9]+-[0-9]+)?");
74bool isProcessorDir(
const string& dir)
76 return (dir.
starts_with(
"processor") && matcher.match(dir));
82int main(
int argc,
char *argv[])
86 "List times using the timeSelector,"
87 " or use to remove selected time directories"
97 "List times from processor0/ directory"
102 "Remove selected time directories"
106 "Report progress of -rm option"
112 const bool removeFiles(
args.found(
"rm"));
113 bool verbose(
args.verbose());
122 if (
args.found(
"processor"))
130 <<
"No processor* directories found"
138 args.caseName()/
"processor0"
153 const label nTimes = timeDirs.size();
178 <<
"Removing " << nTimes
179 <<
" times in " << procDirs.size()
180 <<
" processor directories" <<
endl;
184 if (procDirs.empty())
197 <<
" [" << (nTimes - timei) <<
'/' << nTimes <<
']'
201 for (
const fileName& procDir : procDirs)
212 <<
"Removing " << nTimes
213 <<
" time directories" <<
endl;
224 <<
" [" << (nTimes - timei) <<
'/' << nTimes <<
']'
235 for (
const instant& t : timeDirs)
Various functions to operate on Lists.
static void noBanner()
Disable emitting the banner information.
static void noFunctionObjects(bool addWithOption=false)
Remove '-noFunctionObjects' option and ignore any occurrences.
static void addVerboseOption(const string &usage="", bool advanced=false)
Enable a 'verbose' bool option, with usage information.
static void noJobInfo()
Suppress JobInfo, overriding controlDict setting.
static void addBoolOption(const word &optName, const string &usage="", bool advanced=false)
Add a bool option to validOptions with usage information.
static void noParallel()
Remove the parallel options.
static void addNote(const string ¬e)
Add extra notes for the usage information.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
static autoPtr< T > New(Args &&... args)
Construct autoPtr with forwarding arguments.
A class for handling file names.
An instant of time. Contains the time value and name. Uses Foam::Time when formatting the name.
static void disable() noexcept
Disallow profiling - turns the InfoSwitch off.
bool starts_with(char c) const
True if string starts with given character (cf. C++20).
static void addOptions(const bool constant=true, const bool withZero=false)
Add timeSelector options to argList::validOptions.
instantList select(const instantList ×) const
Select a list of Time values that are within the ranges.
A class for handling words, derived from Foam::string.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
List< fileName > fileNameList
List of fileName.
refPtr< fileOperation > fileHandler(std::nullptr_t)
Delete current file handler - forwards to fileOperation::handler().
messageStream Info
Information stream (stdout output on master, null elsewhere).
List< instant > instantList
List of instants.
regExpCxx regExp
Selection of preferred regular expression implementation.
Ostream & endl(Ostream &os)
Add newline and flush stream.
void inplaceSubsetList(ListType &input, const UnaryPredicate &pred, const bool invert=false)
Inplace subset of the list when predicate is true.
bool rmDir(const fileName &directory, const bool silent=false, const bool emptyOnly=false)
Remove a directory and its contents recursively,.
messageStream InfoErr
Information stream (stderr output on master, null elsewhere).
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
errorManipArg< error, int > exit(error &err, const int errNo=1)
Ostream & flush(Ostream &os)
Flush stream.
fileNameList readDir(const fileName &directory, const fileName::Type type=fileName::Type::FILE, const bool filtergz=true, const bool followLink=true)
Read a directory and return the entries as a fileName List.
constexpr char nl
The newline '\n' character (0x0a).
Foam::argList args(argc, argv)
#define forAllReverse(list, i)
Reverse loop across all elements in list.