Looking for files older than n number of days?
Dan Nelson
dnelson at allantgroup.com
Mon Jun 6 14:16:40 GMT 2005
In the last episode (Jun 06), Jerry McAllister said:
> > I think I found a bug in find.
> > If you add the '-ls' parameter before the -mtime it ignores mtime.
> > Example:
> > find . -ls -mtime -5d
> > Shows all files in directory.
> >
> > find . -mtime -5d -ls
> > Shows correctly files modified less than 5 days old.
>
> I am not sure it is exactly a bug. It seems to be dependant on how
> find processes its parameters - in order of occurance. A similar
> effect can be seen with some other parameter combinations such as
> putting -print in the wrong place - you can get all files in the
> system printed or none rather than just what you want. Possibly the
> man page needs to be updated to make the effect of parameter order
> clear.
Correct. Each primary returns 'true' or 'false', and the first 'false'
primary causes process to end for that file.
OPERATORS
The primaries may be combined using the following operators. The
operators are listed in order of decreasing precedence.
[...]
expression -and expression
expression expression
The -and operator is the logical AND operator. As it is
implied by the juxtaposition of two expressions it does not
have to be specified. The expression evaluates to true if
both expressions are true. The second expression is not
evaluated if the first expression is false.
--
Dan Nelson
dnelson at allantgroup.com
More information about the freebsd-questions
mailing list