LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 05-19-2016, 03:01 AM   #1
devUnix
Member
 
Registered: Oct 2010
Posts: 606

Rep: Reputation: 59
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
total 14004
-rw-rw-rw-. 1 root root 895307 Apr 22 22:08 log.042216
....
-rw-rw-rw-. 1 root root 369390 May 18 21:44 log.051816


[root@ms00443 bpbkar]# cd ..
[root@ms00443 logs]# ls -ld bpbkar/
drwxrwxrwt. 2 root root 4096 May 19 00:00 bpbkar/
[root@ms00443 logs]# date
Thu May 19 07:31:28 GMT 2016
 
Old 05-19-2016, 07:12 AM   #2
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,883
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
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.
 
1 members found this post helpful.
Old 05-19-2016, 08:20 AM   #3
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,671
Blog Entries: 4

Rep: Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945
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.
 
Old 05-19-2016, 12:10 PM   #4
DavidMcCann
LQ Veteran
 
Registered: Jul 2006
Location: London
Distribution: PCLinuxOS, Debian
Posts: 6,142

Rep: Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] renaming files changes directory timestamp qrange Linux - Newbie 2 11-05-2015 04:32 AM
script to timestamp files with timestamp from directory eRJe Programming 4 11-13-2013 06:52 PM
[SOLVED] Updating timestamp in files in directory tuxtutorials Programming 5 08-21-2010 09:03 AM
sort oldest 5 files in a directory tree recursively based on timestamp Linux abhelp Programming 1 06-04-2010 04:58 AM
no file access timestamps being updated! takahaya Linux - General 4 04-03-2005 06:48 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:31 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration