SUMMARY: how does mtime work

From: RichGlazier@netscape.net
Date: Mon Mar 24 2003 - 11:25:27 EST


I should have RTFM, "M" being man page in this case- should have read it more carefully in any case.

I choose two responses to summarize:

The man page is not as helpful as it might be. The important thing to know
is that (roughly speaking)
 find . -mtime n
gives you files modified in a 24-hour period n days ago and
 find . -mtime -n
gives you files modified less than n days ago, and
 find . -mtime +n
gives you files last modified more than n days ago.

So nearly always you want the second or third form, e.g.
 find . -mtime -30

-Bob Vickers

---
You didn't read the "find" reference page carefully enough.  "-mtime"
is one of the several switches that takes a numeric argument in one
of three forms:  an unsigned integer means EXACTLY that value, put a
minus sign in front and it means the value or less, put a plus sign
and it means the value or more.
So, if you want to see the files modified 2 or more days ago, use
"-mtime +2" (that is strictly more than 1 day ago), if you want to
see files modified in the 24 hour period two days ago, code what you
coded, if you want to see the files modified in the last 24 hours,
use "-mtime -1" or "-mtime 1", they mean the same thing.  It's messy.
The way you were doing it keeps changing the 24 hour time slot, so it
finds different files each time.
-Tom Blinn
__________________________________________________________________
Try AOL and get 1045 hours FREE for 45 days!
http://free.aol.com/tryaolfree/index.adp?375380
Get AOL Instant Messenger 5.1 for FREE! Download Now!
http://aim.aol.com/aimnew/Aim/register.adp?promos=380455


This archive was generated by hypermail 2.1.7 : Sat Apr 12 2008 - 10:49:13 EDT