Elliott has asked for the wisdom of the Perl Monks concerning the following question:
According to the Camel Book, -C$filename gives the age of the file in days since the last inode change. Can someone please tell me what that means!?
Specifically, can I use -C to tell me when a file was first created even if it has been overwritten since? (I assume so, since otherwise what would be the difference with -M?) Does it make any difference HOW it was overwritten?
Re: Please explain -C / inode
by emilford (Friar) on Jul 01, 2002 at 22:00 UTC
|
I believe the -C option relative to a filename represents the ctime of the inode. Don't ask me what this means, I'm just reading about it in a book (Perl Cookbook). I've read far enough to get to the following line: "The ctime is not the creation time; there is NO way under standard UNIX to find a file's creation time." Bummer since that is what I think you're trying to do. I'm not saying that it can't be done from personal experience, I'm just stating what was in the book! Below is a brief explanation as stated in the Perl Cookbook.
An inode (index-node) is an entry in the index that are relative to a set of data blocks. The inode is a flat file and is addressed by number. An inode acts as a pointer to a specific set of data blocks, but also contains information on the type of things it represents (directory, plain file, etc).
The inode contains many fields, but of relevance to this post: atime, ctime, and mtime.
atime - updated every time pointer to the file's data blocks is followed and the file's data is read
ctime - updated each time the file's inode changes
mtime - updated each time the file's data changes
You might also want to read up about File::Stat, which provides an interface to all of these values. It's a very effective method of obtaining information about a certain file.
HTH, Eric | [reply] |
|
Thank you for this info. It seems fairly clear that if I want a creation date, I'll have to write it myself somewhere. (Just wish I'd thought of it BEFORE I created the files :-)
My fundamental question is now answered but I am still curious... what on earth is -C for?
| [reply] |
|
The -C is the operator for the ctime stat field. They (-C and ctime) both mean the file's (inode) change time. I can't explain it any further. Perhaps one of the other monks?
| [reply] |
|
what on earth is -C for?
"The field st_ctime is changed by writing or by setting
inode information (i.e., owner, group, link count, mode,
etc.)." -- stat(2)
Next time, maybe you should try Google first.
- Yes, I reinvent wheels.
- Spam: Visit eurotraQ.
| [reply] |
|
|
Re: Please explain -C / inode
by perigeeV (Hermit) on Jul 02, 2002 at 11:02 UTC
|
| [reply] [d/l] |
A reply falls below the community's threshold of quality. You may see it by logging in. |
|
|