Looking for files older than n number of days?

Dan Nelson dnelson at allantgroup.com
Mon Jun 6 04:09:43 GMT 2005


In the last episode (Jun 05), Francisco Reyes said:
> On Sun, 5 Jun 2005, Dan Nelson wrote:
> > "find . -mtime +5" , or "find . -mtime +5d", depending on whether
> > you want 5 days as of the next midnight, or 5 days as of when find
> > was started.
> 
> How do those flags work?
> +5 = changed during last five days?
> -5 = newer than five days?

>From the bottom of the PRIMARIES section of the manpage:

     All primaries which take a numeric argument allow the number to be
     preceded by a plus sign (``+'') or a minus sign (``-'').  A
     preceding plus sign means ``more than n'', a preceding minus sign
     means ``less than n'' and neither means ``exactly n''.
 
> I ran it on a directory and was surprised to find that both -5 AND +5
> listed a file from February. :-(

-5 definitely should not, and doesn't on my system.  It should be
interpreted as "less than 5 days from midnight tonight".

-- 
	Dan Nelson
	dnelson at allantgroup.com


More information about the freebsd-questions mailing list