Find files modified since a given timestamp

If you need to find all files inside a directory that were modified in the last 24 hours you can do this:

find . -mtime 1

You can also refer to another file's timestamp like this:

find . -cnewer other_file

This can be used to check against a specific timestamp, too. This is how you check for all files modified today (since 00:00):

touch -t `date +%m%d0000` /tmp/$$
find . -cnewer /tmp/$$

Note that $$ returns the current bash's PID so you will get some file like /tmp/12345 that stays the same for the current shell. This allows you to check against this file again without conflicting with other users.

Arne Hartherz Over 13 years ago