Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

find is a great tool for finding files. It has the option to find files that were modified in the last X days with -mtime. However I'd like something more fine grained than that. I want to be able to find files that were modified in the last 2 hours. Is there some way to make find (or some other similar tool) do this?

share|improve this question

3 Answers 3

up vote 11 down vote accepted

man find

-mmin

File's data was last modified n minutes ago.

share|improve this answer
    
also see Tometzsk'y answer to serverfault.com/questions/88222/… –  Paul Feb 16 '10 at 17:21
    
to be more verbose, find . -mmin -120 will find all files with an mtime within the past 2 hours –  Paul Feb 16 '10 at 19:07

An alternative to Paul Brewer's (best) answer: -newer. It essentially finds anything newer than a file. So you can use touch to create a timestamp for a file in the past, then see what's newer than that.

touch -t 201002160900 timestamp
find . -newer timestamp
share|improve this answer
    
This trick is great when you need to find stuff modified by running a command (touch timestamp && (some command) && find ...) –  voretaq7 Feb 16 '10 at 17:28

Here is a good link to find out more information about that. http://content.hccfl.edu/pollock/unix/findcmd.htm

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.