Re: File mtime less than atime

 
SOLVED
Go to solution
Ian Dennison_1
Honored Contributor

File mtime less than atime

I tried to cleanup a directory using "find . -mtime +7" and got no results. However, I list the files using "ll" and they definitely show a date more than 7 days ago.

I have since figured out that the value passed to "find" means "the next whole number greater than", so a value of 7 will wait until 8 complete days have passed defore deleting.

However, I still have files with an mtime less than the ctime - has anyone encountered this before?

server1:/package/data/log/log> ls -lu z_crapar_36499
-rw-r--r-- 1 ora817 dba817 45644 Aug 5 14:33 z_crapar_36499

server1:/package/data/log/log> ls -lc z_crapar_36499
-rw-r--r-- 1 ora817 dba817 45644 Oct 7 23:45 z_crapar_36499

server1:/package/data/log/log> ls -l z_crapar_36499
-rw-r--r-- 1 ora817 dba817 45644 Sep 30 16:05 z_crapar_36499

In order,...
Access Time
Create Time
Modify Time

Share and Enjoy! Ian
Building a dumber user
1 REPLY 1
Simon Hargrave
Honored Contributor
Solution

Re: File mtime less than atime

This is perfectly acceptable. the -c time is not strictly "creation" time, rather it is "time of last inode change". Actions such as chmod can update this, eg in the following example: -

$ date
Fri Oct 8 11:51:47 BST 2004
$ touch testfile
$ ls -l testfile
-rw-r----- 1 user tsg 0 Oct 8 11:51 testfile
$ ls -lc testfile
-rw-r----- 1 user tsg 0 Oct 8 11:51 testfile
$ chmod 644 testfile
$ ls -l testfile
-rw-r--r-- 1 user tsg 0 Oct 8 11:51 testfile
$ ls -lc testfile
-rw-r--r-- 1 user tsg 0 Oct 8 11:52 testfile

You see the "chmod" updated the inode, therefore changed the -c time.