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?
Asked
Active
Viewed 3,845 times
3

Amandasaurus
- 31,471
- 65
- 192
- 253
2 Answers
11
man find
-mmin
File's data was last modified n minutes ago.

Paul
- 1,634
- 15
- 19
-
also see Tometzsk'y answer to http://serverfault.com/questions/88222/find-files-modified-in-an-interval-on-unix – 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
4
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

Christopher Karel
- 6,582
- 1
- 28
- 34
-
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