首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >发现-mtime不起作用

发现-mtime不起作用
EN

Ask Ubuntu用户
提问于 2019-10-10 18:30:54
回答 1查看 3.3K关注 0票数 1

我尝试了文章中的所有建议:5个天后删除文件的脚本

当我在没有-mtime参数的情况下运行find时,它会找到我要查找的文件。当我添加-mtime +2时,不会返回任何内容。我知道在我使用find命令查找的目录中有适当日期的文件(S)。

EN

回答 1

Ask Ubuntu用户

发布于 2019-10-10 21:16:24

来自man find

代码语言:javascript
复制
 -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.

 -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.

但也见:

代码语言:javascript
复制
  -daystart
          Measure  times  (for  -amin,  -atime,  -cmin,  -ctime,  -mmin, and -mtime) from the
          beginning of today rather than from 24 hours ago.  This option only  affects  tests
          which appear later on the command line.

总之,使用find -mtime +1查找2天前的文件。

票数 1
EN
页面原文内容由Ask Ubuntu提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://askubuntu.com/questions/1180098

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档