「find -mtime +1」がスクリプトで使用されたときに今日のファイルを含めるのはなぜですか? [閉鎖]

「find -mtime +1」がスクリプトで使用されたときに今日のファイルを含めるのはなぜですか? [閉鎖]

find私のスクリプトは次のコマンドを使用します。

find . -type f -mtime +1

インタラクティブシェルで使用すると古いファイルのみが提供されますが、スクリプト内では現在のファイルも提供されます。なぜ?対話型呼び出しと同じ動作を得るにはどうすればよいですか?

ベストアンサー1

-daystartコマンドラインに以下を含める必要があります。

-daystart
      Measure  times  (for  -amin, -atime, -cmin, -ctime, -mmin, and -mtime)
      from the beginning of today rather  than  from  24  hours  ago.   This
      option only affects tests which appear later on the command line.

しない、真夜中の後にcronjobでスクリプトを実行すると、後でスクリプトを手動で実行した場合とは異なる結果が得られます。

おすすめ記事