I used:

find . -type d -name "SALARIO*"

to find the directories with that word in the name and then:

find . -type f -name "*.txt"

to find all files that end in txt in those directories.

How do I get both to work at the same time without using pipes?


I tried it and it works for me, so I suggest you to use the following command.

find -path '*SALARIO*/*' -name '*.txt'
  • 1
    even if it visually state you intention to split -path -name, you can put everything in -path '*/SALARIO/*.txt' – bac0n Nov 2 at 9:36
  • Didn't knew it bac0n, nice – Ioannis Apostolou Nov 2 at 9:38

Try this find . -wholename "./SALARIO/*.txt"


List *.txt files directly under SALARIO/

$ find -type d -name 'SALARIO' -exec sh -c 'ls $1/*.txt' _ '{}' \;


$ shopt -s globstar; ls **/SALARIO/*.txt

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.