findコマンドでnewermtはどういう意味ですか?


14

このオプションを使用して、特定の変更された時間の間にファイルを検索できることを知っています。しかし、私はこれが何を意味するのか興味がありますか?

man find | grep newermtは何かを見つけようとしていました。しかし、私は直接的なコンテンツを得ませんでした。それはそうです-newer fileし、mtimeものは、それとの関係を有することができます。確信はないけど..

それで、-newermt実際にはどういう意味ですか?

回答:


20

find(1)

-newerXY reference
          Compares the timestamp of the current file with reference.   The
          reference  argument  is  normally the name of a file (and one of
          its timestamps is used for the comparison) but it may also be  a
          string  describing  an  absolute time.  X and Y are placeholders
          for other letters, and these letters select which time belonging
          to how reference is used for the comparison.

          a   The access time of the file reference
          B   The birth time of the file reference
          c   The inode status change time of reference
          m   The modification time of the file reference
          t   reference is interpreted directly as a time

12

find ./ -mtime +nより、すべてのファイルが古い取得するために使用n日を
find ./ -mtime -n最後に変更されたすべてのファイルを取得するために使用n
、使用している場合は今1の代わりにn、あなたはファイルの最後の24時間に変更されます。しかし、過去24時間以内ではなく、昨日のファイルのみが必要な場合はどうでしょうか。ここにnewermt写真が入ります。

find ./ -newermt "2016-01-18" ! -newermt '2016-01-19'

指定した日付より新しい!すべてのファイルを提供し、指定した日付より新しいすべてのファイルを除外します。したがって、上記のコマンドは、2016-01-18に変更されたファイルのリストを表示します。

弊社のサイトを使用することにより、あなたは弊社のクッキーポリシーおよびプライバシーポリシーを読み、理解したものとみなされます。
Licensed under cc by-sa 3.0 with attribution required.