Linux tips
Find files between two dates
April 24, 2016

find files using command line

Find files between two dates

I’d like to share a simple way I’ve learned to find how many files have been created between two dates, using Linux command line. The method involves find command.


Working on a project that involved the creation of a lot of KOS objects (nothing difficult, just another DICOM object), I needed a quick and easy way to find out how many files my class method created.


I knew that find command could help, so I started digging into its manual and at the end I found the right option:

-newerXY file
             True if the current file has a more recent last access time
             (X=a), inode creation time (X=B), change time (X=c), or modifica-
             tion time (X=m) than the last access time (Y=a), inode creation
             time (Y=B), change time (Y=c), or modification time (Y=m) of
             file.  In addition, if Y=t, then file is instead interpreted as a
             direct date specification of the form understood by cvs(1).  Note
             that -newermm is equivalent to -newer.

after many trials I ended up with newermt which is newer with sub-options X=m for modification date and Y=t for literal time.

At this point my “command” was taking shape:

find -type f -name "*.dcm" -newermt 2016-04-08 ! -newermt 2016-04-09

Last thing I needed to know, was the number of files that have been created in the desired date interval and this was the easiest part of the command:

wc -l

the command used prints the newline count.


find -type f -name "*.dcm" -newermt 2016-04-08 ! -newermt 2016-04-09 | wc -l


By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.