find: Comparing Timestamps
1
1 2.3.2 Comparing Timestamps
1 --------------------------
1
1 -- Test: -newerXY reference
1 Succeeds if timestamp 'X' of the file being considered is newer
1 than timestamp 'Y' of the file 'reference'. The letters 'X' and
1 'Y' can be any of the following letters:
1
1 'a'
1 Last-access time of 'reference'
1 'B'
1 Birth time of 'reference' (when this is not known, the test
1 cannot succeed)
1 'c'
1 Last-change time of 'reference'
1 'm'
1 Last-modification time of 'reference'
1 't'
1 The 'reference' argument is interpreted as a literal time,
1 rather than the name of a file. ⇒Date input formats,
1 for a description of how the timestamp is understood. Tests
1 of the form '-newerXt' are valid but tests of the form
1 '-newertY' are not.
1
1 For example the test '-newerac /tmp/foo' succeeds for all files
1 which have been accessed more recently than '/tmp/foo' was changed.
1 Here 'X' is 'a' and 'Y' is 'c'.
1
1 Not all files have a known birth time. If 'Y' is 'b' and the birth
1 time of 'reference' is not available, 'find' exits with an
1 explanatory error message. If 'X' is 'b' and we do not know the
1 birth time the file currently being considered, the test simply
1 fails (that is, it behaves like '-false' does).
1
1 Some operating systems (for example, most implementations of Unix)
1 do not support file birth times. Some others, for example
1 NetBSD-3.1, do. Even on operating systems which support file birth
1 times, the information may not be available for specific files.
1 For example, under NetBSD, file birth times are supported on UFS2
1 file systems, but not UFS1 file systems.
1
1 There are two ways to list files in '/usr' modified after February 1
1 of the current year. One uses '-newermt':
1
1 find /usr -newermt "Feb 1"
1
1 The other way of doing this works on the versions of find before
1 4.3.3:
1
1 touch -t 02010000 /tmp/stamp$$
1 find /usr -newer /tmp/stamp$$
1 rm -f /tmp/stamp$$
1
1 -- Test: -anewer file
1 -- Test: -cnewer file
1 -- Test: -newer file
1 True if the file was last accessed (or its status changed, or it
1 was modified) more recently than FILE was modified. These tests
1 are affected by '-follow' only if '-follow' comes before them on
1 the command line. ⇒Symbolic Links, for more information on
1 '-follow'. As an example, to list any files modified since
1 '/bin/sh' was last modified:
1
1 find . -newer /bin/sh
1
1 -- Test: -used n
1 True if the file was last accessed N days after its status was last
1 changed. Useful for finding files that are not being used, and
1 could perhaps be archived or removed to save disk space.
1