brain hurt and file test

Mark Morgan lemming at
Fri Jun 14 00:09:03 CDT 2002

Tom Phoenix wrote:
> Just in case there's any confusion between the code and the comment: It's
> -M to get the "modification age" and -A to get the "accessed age". Randal
> knows this stuff so well that sometimes he doesn't read the comments. :-)
> As a rule of thumb, when thinking about -M, -A, and -C, you should nearly
> always use -M, which tells you "how old is the data in this file", or "how
> long has it been since this file was updated". The mtime (which is the
> underlying timestamp value used by Perl to calculate the -M value) is the
> timestamp used by 'ls -l' and make, and it's what most people think of as
> the "age" of the file. When in doubt, go with -M.
> The -C filetest is almost never what you want. For those who really need
> to know, it's telling you "how long has it been since anything important
> (like its name, permissions, contents) changed about this file". The ctime
> is used for incremental backups; if the ctime is older than your previous
> incremental backup, you can skip this one. If you're not doing incremental
> backups, you can probably skip this one, too.

There is a case where the -C would be a better choice.  If a file is 
being copied with attributes preserved, once the copy is done the -M 
time will show whatever the original file started as.
This shouldn't be a problem in your case unless a file gets stamped with 
a future time.



More information about the Pdx-pm-list mailing list