linux下查找前一天被修改的文件

来源:互联网 发布:小米网络音响蓝牙连接 编辑:程序博客网 时间:2024/06/05 08:47

题目:linux下查找前一天被修改的文件


解答:

看到这个题目,很多人会想到使用-mtime,但是man find

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

说明是以当前时间为基准,往前24小时,并非以今天0点为基准

man find

-mmin n              File’s data was last modified n minutes ago.

那么查找前一天被修改的就只好用分去锁定:

find -mmin -$(expr `date +%H` \* 60 + `date +%M` + 1440 \* 1) -a -mmin +$(expr `date +%H` \* 60 + `date +%M`)

原创粉丝点击