Jak mogę znaleźć każdy plik i katalog pasujący do wzorca, z wyłączeniem jednego katalogu używającego find?
Powiedzmy, że mam następującą strukturę plików;
.
foo-exclude-me /
foo.txt
foo-exclude-me-not /
foo.txt
bar/
foo.txt
foobar /
bar.txt
foofoo.txt
jak mogę uzyskać następujące dane wyjściowe za pomocą find:
./bar/foo.txt ./bar/foobar ./bar/foobar/foofoo.txt ./foo-exclude-me-not ./foo-exclude-me-not/foo.txt
Próbowałem użyć obu poniższych poleceń:
odnaleźć . -nazwa „foo-exclude-me” -prune -o -nazwa „foo *” odnaleźć . -nazwa „foo *” \! -path './foo-exclude-me/*'
ale obaj zwracają to:
./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
Jak mogę poprawnie wykluczyć foo-exclude-mekatalog?
-printi foo-exclude-mezamiast ./foo-exclude-me.
foo-exclude-mezamiast./foo-exclude-me. Spróbuj także dołączyć-printna końcu polecenia.