In Linux, there is no concept of file creation time. Only the access time, modification time, and status change time of the file. In other words, the creation time of the file cannot be known.
But if the file has not been modified since it was created, the modification time = creation time; if the status has not changed since the file was created, then the status change time = creation time; if the file has not been read since it was created, then Access time = creation time, this is basically impossible.
A few times related to the file:
Access time, read the content of this file once, and this time will be updated. For example, use the more command on this file. Neither the ls nor the stat commands will modify the access time of the file.
Modification time, if the file content is modified once, the time will be updated. For example: save the file after vi. The time listed by ls -l is this time.
Status change time. If you change the file attributes once through the chmod command, the time will be updated.
你不是 windows 吧
os.path.getctime(path)
Return the system’s ctime which, on some systems (like Unix) is the time of the last metadata change, and, on others (like Windows), is the creation time for path. The return value is a number giving the number of seconds since the epoch (see the time module). Raise os.error if the file does not exist or is inaccessible.
In Linux, there is no concept of file creation time. Only the access time, modification time, and status change time of the file. In other words, the creation time of the file cannot be known.
But if the file has not been modified since it was created, the modification time = creation time; if the status has not changed since the file was created, then the status change time = creation time; if the file has not been read since it was created, then Access time = creation time, this is basically impossible.
A few times related to the file:
Access time, read the content of this file once, and this time will be updated. For example, use the more command on this file. Neither the ls nor the stat commands will modify the access time of the file.
Modification time, if the file content is modified once, the time will be updated. For example: save the file after vi. The time listed by ls -l is this time.
Status change time. If you change the file attributes once through the chmod command, the time will be updated.
你不是 windows 吧
os.path.getctime(path)
Return the system’s ctime which, on some systems (like Unix) is the time of the last metadata change, and, on others (like Windows), is the creation time for path. The return value is a number giving the number of seconds since the epoch (see the time module). Raise os.error if the file does not exist or is inaccessible.