0

I have this command:

find /var/cache/pkg  -newermt 2020-01-30 | grep 'kdeaccessibility-4.14.3_1'

Which returns nothing. I change it to this:

find /var/cache/pkg  -newermt 2020-01-30 -exec ls -D '%F' -l -t -r {} \; | grep 'kdeaccessibility-4.14.3_1'

and this is returned:

-rw-r--r--  1 root  wheel        556 2017-07-14 kdeaccessibility-4.14.3_1-6dc124e39c.txz
lrwxr-xr-x  1 root  wheel         40 2017-07-21 kdeaccessibility-4.14.3_1.txz -> kdeaccessibility-4.14.3_1-6dc124e39c.txz

So, the -newermt option seems to be disabled by the -exec option. But I do not understand why.

However, if I add the -type f option then the find works as expected.

find /var/cache/pkg  -type f -newermt 2020-01-30 -exec ls -D '%F' -l -t -r {} \; | grep 'kdeaccessibility-4.14.3_1'

Nothing is returned. I infer from this that presence of a symbolic link is causing the behaviour but I do not understand why.

James B. Byrne
  • 337
  • 1
  • 4
  • 14

1 Answers1

1

I would think the issue is that your find ... -exec ls ... {} \; (without -type f in the find argument list) will run ls also for any matching directories, resulting in ls listing the entire contents of those directories (unless you add the -d option to the ls argument list).

Håkan Lindqvist
  • 35,011
  • 5
  • 69
  • 94