Timestamp of Directory is Updated Whereas Files are Still Having Old Timestamps
Hi,
This may sound a very easy question but I am wondering as to why the timestamp of the directory is updated / current whereas the files inside it have not been updated or no new file has been created therein: Code:
[root@ms00443 bpbkar]# ls -ltr |
Maybe a file was deleted. Not sure if a directory gets it's timestamp updated when you access it. I think not actually. But clearly if you change the contents, it will change the directory timestamp. And one way to change contents is removal of a file. Therefore you would not see any file with the corresponding timestamp.
|
Also, not all filesystems actually update these timestamps. (In some cases, it's an option that you can configure.)
Although they are, in a sense, "convenient," the act of updating them means several additional round-trip disk-I/O operations, and they cause the physical areas on the disk which contain this information to be highly contended-for. The physical read/write head is forced to move-around much more than it otherwise could ... "and, for what?" Yeah, you might update something in it when you're having to read/write it for some other purpose, but otherwise it's just noise-traffic. |
As rtmistler says, the ls command gives the time that the item listed was modified, so if it's a directory that could include deleting a file, moving one in, or moving one out — not just altering a file.
Access times are not given unless you ask with ls -lu but they are always recorded. You can use noatime and nodiratime as mount parameters in /etc/fstab to stop that, if you want to. |
All times are GMT -5. The time now is 02:04 PM. |