Find files modified since a given timestamp

Updated . Posted . Visible to the public.

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
Last edit
Arne Hartherz
Keywords
linux, unix
License
Source code in this card is licensed under the MIT License.
Posted by Arne Hartherz to makandra dev (2010-09-14 08:44)