Link to home
Start Free TrialLog in
Avatar of Emay
Emay

asked on

Why -newer option doesn't work in find command?

I tried to find all the files which were created after a file /tmp/aaa, but it doesn't seem to give me the right answer. Here's what I did ( IRIX6.2):
1. ls -l /tmp/aaa
-rw-r--r--    1 root     sys            7 May 18 07:00 /tmp/aaa
2. stat /tmp/aaa
/tmp/aaa:
        inode 2099346; dev 33554704; links 1; size 7
        regular; mode is rw-r--r--; uid 0 (root); gid 0 (sys)
        st_fstype: xfs
        change time - Tue May 26 11:29:39 1998 <896200179>
        access time - Mon May 18 07:00:00 1998 <895492800>
        modify time - Mon May 18 07:00:00 1998 <895492800>

3. find / -local -newer /tmp/aaa -exec ls -l {} \;
drwxr-xr-x    2 root     sys            9 Feb 20  1997 CDROM
lrwxr-xr-x    1 root     sys            4 Feb 20  1997 debug -> proc
drwxr-xr-x   18 root     sys        12288 May 14 15:28 dev
drwxr-xr-x   19 root     sys        12288 May 18 15:20 etc
dr-xr-xr-x    1 root     sys          512 May 14 15:24 home
drwxr-xr-x    2 root     bin           43 May  8 08:10 krb5
drwxr-xr-x    2 root     sys           72 Nov 11  1997 lib
drwxr-xr-x    2 root     sys           39 Nov 11  1997 lib32
drwxr-xr-x    2 root     sys           21 Aug 25  1997 lib64
drwxr-xr-x    2 root     sys            9 Jan 29 06:28 mnt


Look at those dates! Those I expected should be later than May 18, right?
Please explain to me. Thanks.
Emay
Avatar of ozo
ozo
Flag of United States of America image

perhaps / itself is newer than /tmp/aaa?
try
 find / -local -newer /tmp/aaa -exec ls -ld {} \;
or
 find / -local \! -type d -newer /tmp/aaa -exec ls -ld {} \;

Avatar of Emay
Emay

ASKER

It worked! Thanks a lot!!
But I am not quit get it though. How come ls -ld worked but ls -l did not?
Thank you very much
Emay
You could use something like
 find / -local \! -type d -newer /tmp/aaa -exec ls -l {} \;
(but then you don't get to see if / is newer than /tmp/aaa)
Avatar of Emay

ASKER

Thank you very much for your help
Emay
ASKER CERTIFIED SOLUTION
Avatar of ozo
ozo
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Emay, was there anything else you needed?