When does a UNIX directory change its timestamp

前端 未结 4 662
無奈伤痛
無奈伤痛 2020-12-28 12:14

I used \"touch\" on a file, updating the file\'s timestamp but the parent directory\'s timestamp did not change. However, (as expected) when I created a new file within the

4条回答
  •  南笙
    南笙 (楼主)
    2020-12-28 12:34

    You can use the stat command to find the modified time, creation time etc of a file/directory. Refer to https://linux.die.net/man/2/stat

    The article states: st_mtime of a directory is changed by the creation or deletion of files in that directory. The st_mtime field is not changed for changes in owner, group, hard link count, or mode.

提交回复
热议问题