如何使用“查找"来搜索在特定日期创建的文件? [英] How to use 'find' to search for files created on a specific date?
问题描述
如何使用 UNIX 命令 find
搜索在特定日期创建的文件?
How do I use the UNIX command find
to search for files created on a specific date?
推荐答案
正如 Max 所指出的,您不能,但检查修改或访问的文件并不是那么难.我写了一个 教程 关于这个,直到今天.其本质就是使用-newerXY
和!-newerXY
:
As pointed out by Max, you can't, but checking files modified or accessed is not all that hard. I wrote a tutorial about this, as late as today. The essence of which is to use -newerXY
and ! -newerXY
:
示例:查找 2007 年 6 月 7 日修改的所有文件:
Example: To find all files modified on the 7th of June, 2007:
$ find . -type f -newermt 2007-06-07 ! -newermt 2007-06-08
要查找在 2008 年 9 月 29 日访问的所有文件:
To find all files accessed on the 29th of september, 2008:
$ find . -type f -newerat 2008-09-29 ! -newerat 2008-09-30
或者,在同一天更改了权限的文件:
Or, files which had their permission changed on the same day:
$ find . -type f -newerct 2008-09-29 ! -newerct 2008-09-30
如果您不更改文件的权限,则c"通常对应于创建日期.
If you don't change permissions on the file, 'c' would normally correspond to the creation date, though.
这篇关于如何使用“查找"来搜索在特定日期创建的文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!