我挣扎来包装我的脑海里围绕为什么在find
解释文件修改时间它的方式。具体来说,我不明白为什么-mtime +1
不会显示少于48小时的文件。
作为一个示例测试,我创建了三个具有不同修改日期的测试文件:
[root@foobox findtest]# ls -l
total 0
-rw-r--r-- 1 root root 0 Sep 25 08:44 foo1
-rw-r--r-- 1 root root 0 Sep 24 08:14 foo2
-rw-r--r-- 1 root root 0 Sep 23 08:14 foo3
然后,我使用该-mtime +1
开关查找并得到以下输出:
[root@foobox findtest]# find -mtime +1
./foo3
然后,我与查找-mmin +1440
并获得以下输出:
[root@foobox findtest]# find -mmin +1440
./foo3
./foo2
根据查找的手册页,我知道这是预期的行为:
-mtime n
File’s data was last modified n*24 hours ago. See the comments
for -atime to understand how rounding affects the interpretation
of file modification times.
-atime n
File was last accessed n*24 hours ago. When find figures out
how many 24-hour periods ago the file was last accessed, any
fractional part is ignored, so to match -atime +1, a file has to
have been accessed at least two days ago.
不过,这对我来说仍然没有意义。因此,如果文件的日期为1天23小时59分59秒,那么find -mtime +1
忽略所有内容,而只是将其视为1天0小时0分0秒。在那种情况下,从技术上讲,那一天还不算老,并且被忽略了?
不...不...计算。