Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

find -atime -mtime

Status
Not open for further replies.

Chrissirhc

Programmer
May 20, 2000
926
GB
Hi,

If I type ls -l *x* it gives me two files with todays date and one with one from July.

find /directoryname -name '*x*' -mtime +1

I get files returned that was from July.

Why is this??

Say I run, find /directoryname -name '*x*' -atime 0

It gives me all the files.

Where do I get information about a files time last accessed??

Thanks in advance,

Chris

 
Thanks,

I did that straight after I posted, should have posted back. I'm interested to know what it exactly means though. For example, if I type ls in a directory have I acessed the file. Or do I have to execute it or open it using vi or something??

I need to understand -mtime +1 a little better.

Thanks in advance,

Chris
 
Well, -mtime is based on last modified times, and -atime is based on last accessed times, as you probably know. Last accessed time is the last time the file was opened; by doing an ls you are reading the directory, not the file, so it's not affected.

+1 means more than one day ago, 1 means one day ago, and -1 means less than a day ago. Of course you can use any number of days.

Annihilannic.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top