我最近创建了一个脚本文件 *.ksh,我想获取最后修改/创建的 *.ksh 文件的列表。
我确信您可以以某种方式使用 find 来完成此操作,只是不确定如何操作。
答案1
查找 .-name "*.ksh" -amin -10
将为您提供当前目录树下 10 分钟内访问过的 *.ksh 文件。
更一般地讲,使用
查找 .-name ".ksh" -amin n
在哪里
Numeric arguments can be specified as
+n for greater than n,
-n for less than n,
n for exactly n.
以及以下之一:
-amin n
File was last accessed n minutes ago.
-cmin n
File’s status was last changed n minutes ago.
-mmin n
File’s data was last modified n minutes ago.
-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.
-ctime n
File’s status was last changed n*24 hours ago.
-mtime n
File’s data was last modified n*24 hours ago.