Get file creation time with Python on linux

后端 未结 7 1872
一向
一向 2020-12-16 11:31

os.stat returns st_mtime and st_ctime attributes, the modification time is st_mtime and st_ctime \"change time\" on POSIX. is there any function that return the creation tim

7条回答
  •  醉梦人生
    2020-12-16 12:11

    You probably can't.:

    3.1) How do I find the creation time of a file?

    You can't - it isn't stored anywhere. Files have a last-modified time (shown by "ls -l"), a last-accessed time (shown by "ls -lu") and an inode change time (shown by "ls -lc"). The latter is often referred to as the "creation time" - even in some man pages - but that's wrong; it's also set by such operations as mv, ln, chmod, chown and chgrp.

    The man page for "stat(2)" discusses this.

提交回复
热议问题