find 命令中的 newermt 是什么意思?

Zen*_*Zen 24 command-line find

我知道我可以使用此选项在特定修改时间之间查找文件。但我很好奇这是什么意思?

我曾经man find | grep newermt试图找到一些东西。但我没有直接的内容。似乎-newer filemtime东西可能有关系。但我不确定..

那么,-newermt实际上是什么意思?

Sai*_*ire 30

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
Run Code Online (Sandbox Code Playgroud)


小智 21

find ./ -mtime +n用于获取所有的文件早于n
find ./ -mtime -n来获得最后修改的所有文件n
现在,如果你使用的是1代替n在最近24小时内修改,你会得到的文件。但是,如果您只想要昨天的文件而不是过去 24 小时内的文件怎么办?这newermt就是图片。

find ./ -newermt "2016-01-18" ! -newermt '2016-01-19'
Run Code Online (Sandbox Code Playgroud)

将为您提供比指定日期新的所有文件,!并将排除所有比指定日期新的文件。所以上面的命令会给出一个在 2016-01-18 修改过的文件列表。