Read more

Find files modified since a given timestamp

Arne Hartherz
September 14, 2010Software engineer at makandra GmbH

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
Illustration money motivation

Opscomplete powered by makandra brand

Save money by migrating from AWS to our fully managed hosting in Germany.

  • Trusted by over 100 customers
  • Ready to use with Ruby, Node.js, PHP
  • Proactive management by operations experts
Read more Show archive.org snapshot

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.

Posted by Arne Hartherz to makandra dev (2010-09-14 10:44)