検索を使用したファイルの削除とファイルの除外

検索を使用したファイルの削除とファイルの除外

このコマンドはDWIM規格に準拠していません。

find . \( -name .svn -prune -false \) -o \( -empty -delete \)
find: The -delete action atomatically turns on -depth, but -prune 
      does nothing when -depth is in effect.  If you want to 
      carry on anyway, just explicitly use the -depth option.

-depth効果を追加すると、効果は無効になります-prune。つまり、.svnディレクトリも削除されます。findしたがって、他のツールを使用せずに一部の非トリムパスをトリミングしてから削除するために使用できる構文(存在する場合)は何ですかrm

ベストアンサー1

を使用できます-path。 POSIXではありませんが、多くの実装でサポートされています。

find . \! -path "*/.svn/*" -empty -delete

-regexまたオプションです。

おすすめ記事