2
検索でディレクトリを除外
を使用して1つのディレクトリを除外して、パターンに一致するすべてのファイルとディレクトリを見つけるにはどうすればよいfindですか? 次のファイル構造があるとします。 。 foo-exclude-me / foo.txt foo-exclude-me-not / foo.txt バー/ foo.txt foobar / bar.txt foofoo.txt を使用して次の出力をどのように取得しますかfind: ./bar/foo.txt ./bar/foobar ./bar/foobar/foofoo.txt ./foo-exclude-me-not ./foo-exclude-me-not/foo.txt 次のコマンドの両方を使用してみました: 見つける。-name 'foo-exclude-me' -prune -o -name 'foo *' 見つける。-name 'foo *' \!-path './foo-exclude-me/*' しかし、どちらもこれを返します: ./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 foo-exclude-meディレクトリを適切に除外するにはどうすればよいですか?
11
find