Home » Questions » Computers [ Ask a new question ]

Find last modified/created file of a certain extension

Find last modified/created file of a certain extension

I created a script file *.ksh very recently and I want to get a list of the last modified/created *.ksh files.

Asked by: Guest | Views: 29
Total answers/comments: 1
Guest [Entry]

"find . -name ""*.ksh"" -amin -10

will give you *.ksh files under the current directory tree that were accessed less than 10 minutes ago.

On a more general note, use

find . -name "".ksh"" -amin n

where

Numeric arguments can be specified as
+n for greater than n,
-n for less than n,
n for exactly n.

and one of:

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