検索する引数の順序

検索する引数の順序
0:root@SERVER:/tmp # find /tmp/foo* -mtime +74 -ls | wc -l
    1330
0:root@SERVER:/tmp # find /tmp/foo* -ls -mtime +74 | wc -l
    1750
0:root@SERVER:/tmp # oslevel -s
6100-09-04-1441
0:root@SERVER:/tmp # uname
AIX
0:root@SERVER:/tmp # 

質問:findが同じ出力を提供しないのはなぜですか?

ベストアンサー1

-lsオペランドを使ったのでfindすぐに true を返し、現在のパス名を印刷するので、デフォルトは cancelled-printで、それ以降は操作がなく、-mtime +74効果もありません。

-ls             Always evaluates to the value True. Causes the current path name
                to be printed together with its associated statistics

これにより:

find . -ls -mtime +74 -print

その後、両方のオペランドの結果から集計を取得できます。

おすすめ記事