Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!bionet!agate!ucbvax!decwrl!purdue!haven!aplcen!bink From: bink@aplcen.apl.jhu.edu (Ubben Greg) Newsgroups: comp.unix.questions Subject: Re: find(1) question about mtime Summary: How FIND time arguments work Message-ID: <963@aplcen.apl.jhu.edu> Date: 4 Apr 89 05:04:03 GMT References: <976@n8emr.UUCP> Reply-To: bink@aplcen.apl.jhu.edu (Greg Ubben) Organization: The Johns Hopkins University Lines: 28 In article <976@n8emr.UUCP> lwv@n8emr.UUCP (Larry W. Virden) writes: > >I am using find on both Ultrix 2.3 and SunOS 4.0.1 on a 386i. I have >a file whose ls -l date (documented as the modification time) is >April 1, 1989 at 9:09 am. On my machine, it is after 10am on April 3. >I run find filename -mtime +1 -print. My file's name does not appear. >I run find filename -mtime 1 -print. My file's name DOES appear. > >Note that it is more than 48 hours after the modification time. Why does >find insist that the mtime is only 1 day old? I'm posting this response to Larry's question, as it may be of general interest. Experimentation with the FIND and TOUCH commands reveals that the argument forms -N, N, and +N, are always mutually exclusive (as math's <, =, and > operators are). The form N refers to the 24-hour period ENDING exactly N days ago, +N refers to any time before that period, and -N refers to any time after that period. For example, the primaries "-mtime 0" and "-mtime -1" are both true only on files that have been modified within the last 24 hours. "-mtime 1" is true for files that are between 48 and 24 hours old, and "-mtime +1" is true for files that haven't been modified within the last 48 hours. The extra day can be accounted for by the time change that occured on April 2nd. It WASN'T more than 48 hours after the modification time yet -- it just appears that way because the "before" time is formatted in standard time and the "after" time is formatted in daylight savings time. -- Greg Ubben bink@aplcen.apl.jhu.edu