如何显示特定日期写入的文件

我有一个文件夹,里面既有文件,也有子文件夹(包含文件)。我想显示在2018年2月23日至28日期间写入的所有文件*.pth.tar。这个可行吗?
请问我需要使用什么命令来实现这个功能?
谢谢。
1个回答

你可以使用find命令的-newermt测试来查找在一定日期范围内被修改过的文件。例如:
find path/to/folder/ -name '*.pth.tar' -newermt '23 Feb 2018' ! -newermt '01 Mar 2018'

!!是一个逻辑否定运算符。来自man find:

   -newerXY reference
          Succeeds  if  timestamp  X of the file being considered is newer
          than timestamp Y of the file reference.   The letters  X  and  Y
          can be any of the following letters:

          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