1

After extracting an archive to the wrong place, I thought I'd erase everything created after it, but find . -cnewer archive.7z gave the wrong results.

So I made a controlled test by touching three files and changing their ctime with mv so they'd be in the opposite order:

$ stat --printf '%n mod: %y chg: %z\n' oldest middle newest oldest mod: 21:57:13.935530400 chg: 22:05:48.369608300 middle mod: 21:58:23.939659500 chg: 22:05:09.911614500 newest mod: 21:59:33.943477100 chg: 22:04:55.869205500 

(Trimmed for legibility)

Now let's test -newer and -cnewer:

$ find . -type f -newer middle ./newest 

Okay.

$ find . -type f -cnewer middle ./middle ./newest ./oldest 

Not okay.

From fstab and mount:

UUID=46A8DB5D20C177B0 /mnt/stuff ntfs rw,uid=ariel,fmask=027,dmask=027 0 0 /dev/sda1 on /mnt/stuff type fuseblk (rw,nosuid,nodev,allow_other,default_permissions,blksize=4096) 

1 Answer 1

1

Read the find manpage's description of -cnewer

-cnewer file

File's status was last changed more recently than file was modified.

Emphasis mine.

All of the files were modified before 22:00 and were changed after 22:00, so they were all changed after any one of them was modified. Thus they are all listed.

So the result seems correct.

Whether that makes -cnewer useful or not is a different question!

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.