Unix find -mtime {一个负值或正值}

Uni*_*bun 3 unix gnu-findutils

做什么find -mtime -4find -mtime +4做什么?我无法理解手册页中给出的示例。

SMA*_*SMA 7

根据手册页:

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

参数 to-mtime被解释为文件年龄的全天数。-mtime +n表示严格大于,-mtime -n表示严格小于。

所以在你的情况下,

-4意思是少于4天。
+4意思是超过 4 天,即 4*24 小时。


wgi*_*cht 5

好吧,我可以。

-mtime n
Run Code Online (Sandbox Code Playgroud)

文件数据的最后修改时间为n * 24小时。请参阅注释-atime以了解舍入如何影响文件修改时间的解释

find . -mtime 0   # find files modified between now and 1 day ago
                  # (i.e., within the past 24 hours)
find . -mtime -1  # find files modified less than 1 day ago
                  # (i.e., within the past 24 hours, as before)
find . -mtime 1   # find files modified between 24 and 48 hours ago
find . -mtime +1  # find files modified more than 48 hours ago
Run Code Online (Sandbox Code Playgroud)