在 Linux 机器上查找两个日期之间修改的文件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9705579/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 05:11:13  来源:igfitidea点击:

Find files modified between two dates on Linux machine

linuxunix

提问by dheer_krish

On Linux/Unix machine how do I find files modified between a certain number of days ago ? For example say between 2 and 5 days ago, not calendar dates but days ago from right now. So files modified more than 2 days ago, but not more than 5 days days ago. It would not return anything that was modified yesterday, for example.

在 Linux/Unix 机器上,如何找到在特定天数之前修改过的文件?例如说 2 到 5 天前,不是日历日期,而是从现在开始的几天前。所以文件修改时间超过 2 天,但不超过 5 天。例如,它不会返回昨天修改的任何内容。

采纳答案by Gargi Srinivas

If you want to do it on the Unix command line, try using find with the -mtime option.

如果您想在 Unix 命令行上执行此操作,请尝试使用带有 -mtime 选项的 find。

Example:

例子:

find /home -iname ".c" -mtime 2 -mtime -4

will choose files modified two to four days ago.

将选择两到四天前修改过的文件。