BDE 4.14.0 Production release
|
Provide a utility class for configuration-based file removal.
This component defines a struct
, balb::FileCleanerUtil
, that provides a utility function for removing files based on a configuration.
The removeFiles
function implements generic filename pattern matching and removal logic. The user is responsible for calling this function with parameters that do not cause any interference with the application logic. Specifically, the user must pay attention to the supplied pattern to avoid removal of important application data files. See balb_filecleanerconfiguration for further information.
This section illustrates intended use of this component.
The following snippets of code illustrate the basic usage of balb::FileCleanerUtil
.
Let's assume that the application was set up to log to files having the following pattern:
We want to clean up all the files older then a week, but leave at least 4 latest log files. First, we create a cleanup configuration object that will capture our parameters:
Then, we use this configuration to do a file cleanup: