首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >查找-mtime的行为

查找-mtime的行为
EN

Unix & Linux用户
提问于 2016-12-14 10:23:54
回答 1查看 1.5K关注 0票数 0

我在目录new中有以下文件:

代码语言:javascript
复制
Dec 14 04:35 New_folder
Dec 13 05:50 abc.sh
Dec 13 06:33 ashutosh.txt
Dec 13 06:40 delete.sh
Dec 13 07:19 test.bat
Dec 14 04:44 test.sh
Dec 14 04:30 xyz.sh

并运行以下命令

代码语言:javascript
复制
find /test/new/ -type f -mtime +1

根据这个命令的定义,我将在12月14日运行时,得到所有在一天以上的文件,但是输出中没有任何文件。

什么是有效的命令行?

EN

回答 1

Unix & Linux用户

发布于 2016-12-14 10:41:59

find循环到最近的24小时;这包括您的所有文件:

代码语言:javascript
复制
If no units are specified, this primary evaluates to true if the
difference between the file last modification time and the
time find was started, rounded up to the next full 24-hour period,
is n 24-hour periods.

要检查这一点,请在其中一个文件上尝试touch -t

代码语言:javascript
复制
touch -t 12011200 abc.sh

如果您重新运行find命令,现在应该会看到abc.sh (因为您的touch命令将abc.sh的最后访问/修改时间设置为12月1日12:00)。

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

https://unix.stackexchange.com/questions/330278

复制
相关文章

相似问题

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