Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

find... -newer / -cnewer diffs

309 views
Skip to first unread message

Antonio Macchi

unread,
Oct 5, 2008, 12:19:13 PM10/5/08
to
i can't understand the difference between 'find -newer' and 'find -cnewer'

-----------------

$ touch x y

$ echo "OK" > x

$ ls -lagG --full-time x y
-rw-r--r-- 1 3 2008-10-05 18:13:26.000000000 +0200 x
-rw-r--r-- 1 0 2008-10-05 18:13:18.000000000 +0200 y

$ find . -newer y
./x

$ find . -cnewer y
./x

-----------------

can someone show me the difference?
thanks

Alexander Joelly

unread,
Oct 5, 2008, 1:38:39 PM10/5/08
to

-cnewer shows if the file status is changed
-newer shows if the file itself has modified

compare now the output of both files with 'stat' and you will see that
your echo updated the modify and the change status;

Jasen Betts

unread,
Oct 6, 2008, 5:53:58 AM10/6/08
to
On 2008-10-05, Antonio Macchi <antonio...@alice.it> wrote:
> i can't understand the difference between 'find -newer' and 'find -cnewer'

first you need to understand the difference between ctime and mtime

-newer y compares mtime with the mtime of y

-cnewer y compares ctime with the mtime (!) of y

see the manpage for stat

Bye.
Jasen

0 new messages