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
how to find ot ctime , mtime ,atime nilesrex Shell Programming and Scripting 5 1 Week Ago 01:35 PM
Problem with find command when used with mtime arunkumar_mca UNIX for Dummies Questions & Answers 4 01-07-2008 09:37 PM
problem with find and mtime arunkumar_mca UNIX for Dummies Questions & Answers 4 11-05-2007 04:41 AM
find . -mtime topcat8 UNIX for Dummies Questions & Answers 1 04-26-2006 07:55 AM
find -mtime +2? means after 48 hours.. yls177 UNIX for Dummies Questions & Answers 1 11-08-2002 04:59 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 08-21-2005
Registered User
 

Join Date: Aug 2005
Posts: 3
find -mtime off by one day?

If I use the find command to find files older than n days I have to enter
find . -mtime +(n-1). I tried this on a Solaris 9 system and also Linux. Is this something that all Unix veterans know about (I'm new to Unix)? If so, maybe my man pages need to be updated (how to do this?).
Reply With Quote
Forum Sponsor
  #2  
Old 08-22-2005
blowtorch's Avatar
Supporter
 
Join Date: Dec 2004
Location: Singapore
Posts: 2,326
Yes, you have to specify one day less. This is something that you should find in the man pages.
Reply With Quote
  #3  
Old 08-22-2005
Registered User
 

Join Date: Aug 2005
Posts: 3
No, the man pages don't describe this. I based my code on the man pages and now I have to change to it use n-1 instead of n. Who controls the Unix man pages and how do I get updates?
Reply With Quote
  #4  
Old 08-22-2005
Ygor's Avatar
Moderator
 

Join Date: Oct 2003
Location: -31.96,115.84
Posts: 1,248
From the manual pages for GNU find...
Code:
      -atime n
             File was last accessed n*24 hours ago.  When find figures out how  many  24-hour  preiods
             ago  the file was last accessed, any fractional part is ignored, so to match -atime +1, a
             file has to have been modified at least two days ago.

      -mtime n
             File's  data was last modified n*24 hours ago.  See the comments for -atime to understand
             how rounding affects the interpretation of file modification times.
Reply With Quote
  #5  
Old 08-24-2005
Registered User
 

Join Date: Aug 2005
Posts: 3
Thanks, Ygor. The man pages on my Solaris and Linux systems don't have this text but they do behave as you described.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 06:37 PM.


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

Content Relevant URLs by vBSEO 3.2.0