Find Files Modified Between Given Dates
Written by Guillermo Garron
Date: 2012-04-29 10:49:00 00:00
How to find files modified between specific dates in Mac or Linux?
You can use touch
, find
and xargs
to do that.
Find files modified between given dates
First create files with touch
with lower and upper dates of the range.
touch -t 201201010000 lower-date
touch -t 201203012359 upper-date
Now use find
and xargs
to list all files between those dates.
find . -newer lower-date -a ! -newer upper-date -print0 | xargs -0 ls -ld
Find files created between given dates
Using the same files, we are going to tell find to look for files created files between dates of the modification dates of our recently created files.
find . -newerBm z -a \! -newerBm zz -print0 | xargs -0 ls -ld
Do not forget to read the man find
page.