Operating System - HP-UX
1819794 Members
3220 Online
109607 Solutions
New Discussion юеВ

-ctime & -mtime difference in find command ?

 
SOLVED
Go to solution
Sammy_2
Super Advisor

-ctime & -mtime difference in find command ?

Why -ctime yields no result but -mtime yields
1 result (as expected) ? I would expect both
to work alike . Thanks

# date
Thu Dec 15 10:22:23 EST 2005
# touch -mt 12011259 ahd_12_15_05.log
# ll ahd_12_15_05.log
-rwxr-xr-x 1 root sys 0 Dec 1 12:59 ahd_12_15_05.log
# find $APP_LOG -name 'ahd*log' -ctime +10

# find $APP_LOG -name 'ahd*log' -mtime +10
/opt/hpws/apache/logs/ahd_12_15_05.log
good judgement comes from experience and experience comes from bad judgement.
3 REPLIES 3
Eric Antunes
Honored Contributor

Re: -ctime & -mtime difference in find command ?

Hi Sammy,

ctime is Creation time and mtime is Modification time. So it is expected to act differently. See "man find" for more info...

Best Regards,

Eric Antunes
Each and every day is a good day to learn.
James R. Ferguson
Acclaimed Contributor
Solution

Re: -ctime & -mtime difference in find command ?

Hi Sammy:

The 'ctime' of a file represents the last inode change --- change in permissions, ownership, name.

The 'mtime' is the last modification time of a file or directory.

The 'atime' is the last access time.

There is *no* creation time recorded. The only time (no pun) that you reveal the creation time is when the file (or directory) has never been modified since its creattion. Then, and only then, is 'mtime' a creation time.

If you use 'fbackup' beware that the 'ctime' of the files you backup will be changed. This is because 'fbackup' reset the file's lat access timestamp ('atime'). In doing so, the the 'ctime' is changed because the operation updated the inode information.

Regards!

...JRF...
Sammy_2
Super Advisor

Re: -ctime & -mtime difference in find command ?

Thanks to both. thanks JRF for the tip on fbackups.
good judgement comes from experience and experience comes from bad judgement.