find -type f はまだディレクトリを返します。これを防ぐ方法は?

find -type f はまだディレクトリを返します。これを防ぐ方法は?

私の検索コマンドは次のとおりです

find / -mindepth 1 -type f -path /exclude1 -prune -o -path /exclude2 -prune -o -printf '%p %Cs %s\n'

私が得た結果は、例えば次のとおりです。

/lost+found 1151063954 16384
/dir/subdir 1483455984 4096
/dir/subdir/file.properties 1440054032 453

これで、結果から/dir/subdirを表示したくなくなりました。この問題をどのように解決できますか?

ベストアンサー1

検索コマンドの最後に-type fを入れる必要があります(printfの前に)。それは次のようになります:

find / -mindepth 1 -path /exclude1 -prune -o -path /exclude2 -prune -o -type f -printf '%p %Cs %s\n'

おすすめ記事