The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
search by modified date kotasateesh Shell Programming and Scripting 4 3 Weeks Ago 06:59 AM
date search thirumaran Shell Programming and Scripting 5 09-23-2007 11:54 PM
Search files between a date range zcanji Shell Programming and Scripting 4 09-05-2007 12:38 AM
Shell script: last modification date for a file onlyc UNIX for Dummies Questions & Answers 4 07-06-2006 10:01 AM
command for modification date of a file scampsd UNIX for Dummies Questions & Answers 5 12-28-2005 04:14 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-24-2006
Registered User
 

Join Date: May 2006
Posts: 3
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
Search by modification date

Hi

I'd like to know if is it possible to find files given a certain modification date (say, 01-05-2006, that's 1st of May 2006)

I can calculate the days backward:

Code:
find / -ctime 23
but I wish to search by exact modification day


Thanks
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 05-24-2006
reborg's Avatar
Administrator
 
Join Date: Mar 2005
Location: Ireland
Posts: 3,407
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
Substitue mtime for ctime in your command.
Reply With Quote
  #3 (permalink)  
Old 05-24-2006
Registered User
 

Join Date: May 2006
Posts: 3
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
mtime makes more sense than ctime because it considers the file last modification time instead of change of file status, but I still get the same results

I would express my question as:

How can I find files modified on 01-05-2006 on my computer?
Reply With Quote
  #4 (permalink)  
Old 05-24-2006
Registered User
 

Join Date: May 2006
Posts: 3
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
Dunno if I understood your question right, but anyway try below.

Find no of days difference (Difference.Days=Current.Date-Search.Date [E.g, No.of.days.difference between 20060525 and 20060520 is 5]). Say you wanna search your file in a directory called "XXX" exactly 5 days before.

find XXX -mtime 5 -depth -type f

The above command will list you all files in XXX modified 5 days before.

Karthik
Reply With Quote
  #5 (permalink)  
Old 05-25-2006
Registered User
 

Join Date: May 2006
Posts: 3
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
Yes, if I want to search files modified 5 days ago in my computer I type:

Code:
find / -mtime 5 2>/dev/null
the 2>/dev/null is just to prevent output about "Permission denied" directories

But, what if I want to search for files modified on 01-01-1999 ?
Reply With Quote
  #6 (permalink)  
Old 05-25-2006
reborg's Avatar
Administrator
 
Join Date: Mar 2005
Location: Ireland
Posts: 3,407
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
See the section in the FAQ on date manipulation.
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 04:55 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101