Looking for files older than n number of days?

Jerry McAllister jerrymc at clunix.cl.msu.edu
Mon Jun 6 14:01:56 GMT 2005


> 
> On Sun, 5 Jun 2005, Dan Nelson wrote:
> 
> >> 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".
> 
> 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.

////jerry

> _______________________________________________
> freebsd-questions at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at freebsd.org"
> 



More information about the freebsd-questions mailing list