
For POSIX compliance, the find(1) utility calculates time differently beginning with the UNICOS 9.0 release. You should verify scripts that use the find utility; to achieve the desired results, you may have to rewrite some scripts.The change affects the -atime, -ctime, and -mtime primaries. The meaning of the numeric argument n to these primaries changed in the following two ways:
Therefore, the find utility now calculates starting points in 24-hour increments from the current time (that is, from now, the current second) rather than from the 24-hour block that started at last midnight. A starting point equals the current time minus 86,400 seconds (the number of seconds in 24 hours) times n. The period defined by n is as follows:
- In UNICOS 8.0 and earlier, n is day units (0 equals the 24 hours since the last midnight). In UNICOS 9.0 and later, n is 24-hour blocks starting with the current time (0 equals the 24-hour block that begins now).
- In UNICOS 8.0 and earlier, - is time after the end of the 24-hour block and + is time before the start of the 24-hour block. In UNICOS 9.0 and later, + and - refer to the same one-second starting point in time.
- n: Starting point to the starting point plus 1 day (or, the 24-hour period that begins at n)
- +n: Any time before (earlier than) the starting point (that is, older than n)
- -n: Any time after (later than) the starting point (that is, younger than n)
The effects of the first change are illustrated in the following example:
find . -mtime +0In UNICOS 8.0 and earlier releases, this command finds any files in the current directory and its subdirectories that are older than last midnight. Some administrators use this as part of a command or script to remove day-old files from /tmp. Conversely, beginning with UNICOS 9.0, this command finds all files older than now (that is, it finds anything older than 24n hours, and because n is 0, it finds all files older than now).
In UNICOS 9.0, to find all files that are older than 24 hours, use the following command:
find . -mtime +1The effects of the second change are illustrated in the following command-sequence example:
find . -mtime +1 -print find . -mtime 1 -print find . -mtime -1 -printIn UNICOS 8.0 and earlier releases, these three commands produce mutually exclusive listings, which together include any and all files. Beginning with UNICOS 9.0, the second command produces a listing that is almost entirely included in the listing produced by the third command.
In summary, to avoid unexpected results when using the POSIX-compliant find utility, you should verify any scripts that use the find utility with the -atime, -ctime, and -mtime primaries, and you should be aware of these changes in behavior when you invoke the find utility at the command line with these primaries.
Note also, that -print now seems to be the default.