Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it always true that when a new file is created in a directory - the directory's mtime changes?

share|improve this question
This is quite easy to test... – ewwhite May 10 '12 at 20:08
Easy. However, not on all OSes & filesystems at once :) – kolypto May 10 '12 at 20:12

The short answer is yes, it should. A longer answer follows.

A directory is a special kind of file; its contents is a set of (filename, i-node) tuples. Thus directory's mtime is updated whenever a tuple is added, removed or changed - that is, a file of any type (including hard links and directories) is added, removed or renamed.

Please note when file's metadata changes (owner, group, mode, atime, ctime, mtime - hosted in i-node), mtime is NOT updated (neither on the file nor containing dir) but the file's ctime does.

See also Base Definitions volume of IEEE Std 1003.1-2001, Section 4.7, File Times Update.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.