LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-30-2010, 02:27 AM   #1
riteshanand40
LQ Newbie
 
Registered: Dec 2007
Posts: 14

Rep: Reputation: 0
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.
 
Old 04-30-2010, 03:25 AM   #2
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1198Reputation: 1198Reputation: 1198Reputation: 1198Reputation: 1198Reputation: 1198Reputation: 1198Reputation: 1198Reputation: 1198
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.

Last edited by catkin; 04-30-2010 at 03:26 AM. Reason: emboldening
 
Old 04-30-2010, 04:12 AM   #3
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
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.
 
  


Reply

Tags
find


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Zipping files by a date range nixusr Linux - Newbie 3 06-10-2008 12:14 PM
shell script to find modified date and last accessed date of any file. parasdua Linux - Newbie 6 04-22-2008 09:59 AM
Command line: How do I backup files modified after a specific date only rm_-rf_windows Linux - General 2 06-28-2007 08:34 PM
Sorting all files of home folder modified after a specific date for backup fc6_user Linux - General 2 03-30-2007 02:24 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:15 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration