6

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?

6

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
4

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

2

List *.txt files directly under SALARIO/

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

Or

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