How To Find Files Newer Than A Specific Date Using Command Line

find files newer than a specific date using command line

While doing some server admin tasks the other day I needed to find all the files newer than a certain date. Using just the command line tools it was relatively simple but not obvious, so this is a note to self.

The find utility has an option to find a file newer than another file. By creating an empty file with a specific creation date we can do the search:

touch timestamp -d 2010-01-01

To show all files newer than 2010-01-01 use:

find . -newer timestamp

Or to create a tar archive of them use xargs like so:

find . -newer timestamp | xargs tar -rf /root/filesnewerthan-2010-01-01.tar


Image courtesy of Luca Bravo | Unsplash

Related Articles
Engineering for Zero Downtime – Advanced RDS Database Migrations
Why Tech Integration Should Be Part Of Your Product Development Strategy

Related Content

This post was posted in , , , , , , by on