find(1) question about mtime
Ubben Greg
bink at aplcen.apl.jhu.edu
Tue Apr 4 15:04:03 AEST 1989
In article <976 at n8emr.UUCP> lwv at 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 at aplcen.apl.jhu.edu
More information about the Comp.unix.questions
mailing list