Quick Links:

bal | bbl | bdl | bsl

Namespaces

Component balb_filecleanerutil
[Package balb]

Provide a utility class for configuration-based file removal. More...

Namespaces

namespace  balb

Detailed Description

Outline
Purpose:
Provide a utility class for configuration-based file removal.
Classes:
balb::FileCleanerUtil utility class for removing selected files
See also:
Component balb_filecleanerconfiguration
Description:
This component defines a struct, balb::FileCleanerUtil, that provides a utility function for removing files based on a configuration.
General Features and Behavior:
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.
Usage:
This section illustrates intended use of this component.
Example 1: Basic Usage:
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:
  const char *appLogFilePattern = "/var/log/myApp/log*";
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: