find-filter - fine-grained file selection based on time attributes
$PCP_BINADM_DIR/find-filter [
-v?]
predicate
find-filter is a filter for a list of file names read on standard input,
and if the files match the
predicate their names are written on
standard output.
The supported
predicate forms are based on the file's creation time or
modification time, and take the form
ctime or
mtime followed by
a time specification. A time specification takes the form of a
+ or
- followed by days (a non-negative integer), optionally followed by a
colon (
:) and hours (an integer in the range 0 to 23), optionally
followed by another colon (
:) and minutes (an integer in the range 0
to 59).
The semantics of the time specification are that a file matches the predicate if
the chosen time attribute for the file is
less than (
+) the
current time minus the time specification, else
more than or equal to (
-) the current time minus the time specification. Alternatively,
+ means
before the current time minus the time specification,
and
- means
at or
after the current time minus the time
specification.
find-filter is intended to be used to provide finer-grain and platform
independent selection compared to the
-mtime or
-ctime options
of
find(1).
find-filter is expected to be used as a post-filter
for the output from
find(1), and this is how it is used in the
pmlogger_daily(1) scripts to select files to be compressed or culled.
The following
predicate examples illustrate some typical uses.
- mtime +3
- Matches files modified more than 3 days ago.
- ctime -0:2
- Matches files created in the last 2 hours.
- ctime +0:0:15
- Matches files created more than 15 minutes ago.
There are none, unless the
-v option is used, in which case some
diagnostics are written to standard error.
Exit status is always zero, unless there are errors found when parsing the
command line arguments.
find(1) and
pmlogger_daily(1).