LinuxQuestions.org
Help answer threads with 0 replies.
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, 03: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, 04:25 AM   #2
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Servers: Debian Squeeze and Wheezy. Desktop: Slackware64 14.0. Netbook: Slackware 13.37
Posts: 8,563
Blog Entries: 29

Rep: Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179
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 04:26 AM. Reason: emboldening
 
Old 04-30-2010, 05:12 AM   #3
colucix
Moderator
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957
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 01:14 PM
shell script to find modified date and last accessed date of any file. parasdua Linux - Newbie 6 04-22-2008 10:59 AM
Command line: How do I backup files modified after a specific date only rm_-rf_windows Linux - General 2 06-28-2007 09:34 PM
Sorting all files of home folder modified after a specific date for backup fc6_user Linux - General 2 03-30-2007 03:24 AM


All times are GMT -5. The time now is 12:50 PM.

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration