Como posso encontrar todos os arquivos e diretórios correspondentes a um padrão, excluindo um diretório usando find?
Digamos que eu tenha a seguinte estrutura de arquivo;
.
foo-exclude-me /
foo.txt
foo-exclude-me-not /
foo.txt
Barra/
foo.txt
foobar /
bar.txt
foofoo.txt
como obteria a seguinte saída usando find:
./bar/foo.txt ./bar/foobar ./bar/foobar/foofoo.txt ./foo-exclude-me-not ./foo-exclude-me-not/foo.txt
Eu tentei usar o seguinte comando:
encontrar . -name 'foo-excluir-me' -prune -o -name 'foo *' encontrar . -name 'foo *' \! -path './foo-exclude-me/*'
mas os dois retornam isso:
./bar/foo.txt
./bar/foobar
./bar/foobar/foofoo.txt
./foo-exclude-me # << this should be excluded
./foo-exclude-me-not
./foo-exclude-me-not/foo.txt
Como posso excluir corretamente o foo-exclude-mediretório?
-printe em foo-exclude-mevez de ./foo-exclude-me.
foo-exclude-mevez de./foo-exclude-me. Além disso, tente anexar-printno final do comando.