Chel MS
Chel MS

Reputation: 466

Combine two find commands

I'm looking to find the folder named - secrets, under /home/build, if found, check if it has a tar.gz file under it, recursively.

I tried some thing like below but it didn't work, how can I fix this ?

find -type d \( -name "secrets" \) -exec find . -type f -name "*.tar.gz"

OS - MacOS

Upvotes: 0

Views: 105

Answers (1)

Philippe
Philippe

Reputation: 26935

this should work :

find -type d \( -name "secrets" \) -execdir find {} -type f -name "*.tar.gz" \;

Upvotes: 1

Related Questions