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.

1 Answer 1

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).

1
  • Adding -d to the ls options and removing -type f from find did indeed return the expected behaviour. Thanks. May 27, 2020 at 22:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .