Krzysztof Voss
Krzysztof Voss

Reputation: 1844

find ignores the first filename that I search for

I search for two files that has changed recently in a folder, but it seems I invoke find incorrectly. In return I get only the results for the second file.

find /tmp -name 'twofirmscoop.so' -o -name 'twofirms.so' -exec ls -lt {} + 2>/dev/null

Upvotes: 3

Views: 69

Answers (2)

yasu
yasu

Reputation: 1364

Try this:

find /tmp \( -name 'twofirmscoop.so' -o -name 'twofirms.so' \) -exec ls -lt {} + 2>/dev/null

Upvotes: 1

William Pursell
William Pursell

Reputation: 212584

The -exec argument only applies to the second match. To group them, do:

find /tmp \( -name 'twofirmscoop.so' -o -name 'twofirms.so' \) -exec ls -lt {} +

Upvotes: 2

Related Questions