A recurring task can be configured to remove files in a specified directory that match a given pattern, excluding files that match count-based, time-based, or space-based retention criteria. If any files are to be removed, the oldest files will be removed before the most recent file.

If the file name pattern includes a "${timestamp}" element, the timestamp is used to identify the file's age. If the file name pattern does not include a timestamp, then the file's age is determined by using the file's creation time if that is available, or the last modified time if the creation time is not available. If a file's age cannot be determined, the file is not removed.

If multiple files have the same age, lexicographic ordering is used to differentiate between them. Lexicographic ordering is applicable only for files with no retain-file-age property configured, or for files that are older than that age. If multiple files do not share the same age, but that age is younger than the retain-file-age value, then those files are retained.

At least one of the retain-file-count, retain-file-age, or retain-aggregate-file-size properties must be specified.