Find files by date

All examples on this page search from the current directory, as specified by the dot after the find command.

To locate files that have been modified after [date]:

touch -d [date] date_marker
find . -newer date_marker 

Where [date] can be "13 may 2001 17:54:19" or "20091231" for example.

To find files created before [date], use the cnewer and negation conditions:

find . \! -cnewer date_marker

To find files betwee two times (1st Nov 2009 23:59 and 3rd Nov 23:59 in this example):




touch -t $oldtime ./tmpoldfile
touch -t $newtime ./tmpnewfile

find . -type f -newer ./tmpoldfile ! -newer ./tmpnewfile -ls

The -ls flag has find show more details of each file.

find also has anewer for searching by access time, and cnewer for searching by status change time.

Note: After testing, the following doesn't seem to work properly:

From the The Linux Cookbook: Tips and Techniques for Everyday Use - Finding Files.

To list all of the files in the `/usr' directory tree that were modified one year or longer ago, type:

find /usr -mtime +356 -daystart

To list all of the files in your home directory tree that were modified from two to four days ago, type:

find ~ -mtime 2 -mtime -4 -daystart


Last modified: 12/12/2009 Tags: (none)

This website is a personal resource. Nothing here is guaranteed correct or complete, so use at your own risk and try not to delete the Internet. -Stephan

Site Info

Privacy policy

Go to top