LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Find all files modified in a date range (http://www.linuxquestions.org/questions/linux-newbie-8/find-all-files-modified-in-a-date-range-805105/)

riteshanand40 04-30-2010 02:27 AM

Find all files modified in a date range
 
Hi,

I need to know all files modified within a date and time range.

E.g: All modified files between 20 April 2010, 1100-1200 Hrs.

"find / -mtime +10 ! -mtime +11" :: this i found for date but how to include time as well.

Please suggest.

Regards,
Ritesh A.

catkin 04-30-2010 03:25 AM

If your version of find supports it you could use -newermt 'early_timestamp' -a ! -newermt 'late_timestamp' where *_timestamp are valid arguments to the -d option of the date command.

colucix 04-30-2010 04:12 AM

In case the find version does not support the -newermt feature, it is a little more tricky, e.g.
Code:

$ touch -t 201004201059 /tmp/file1
$ touch -t 201004201200 /tmp/file2
$ find . -newer /tmp/file1 -a ! -newer /tmp/file2

Regarding the -mtime, -atime and -ctime tests, they take in account fractions of the day but are related to the current time.


All times are GMT -5. The time now is 09:46 AM.