PHP - 如何在Unix系统中设置文件的ctime
PHP - How to set ctime of a file in Unix system
是否可以将文件的 ctime 设置为所需的值。我正在处理还原脚本,我需要在还原文件后将文件的 ctime 设置为以前的时间戳。
我试过touch
函数,但它只设置了atime和mtime。
ctime
is the inode or file change time. The ctime
gets updated when the file attributes are changed, like changing the owner, changing the permission or moving the file to an other filesystem but will also be updated when you modify a file.
因此您需要对文件执行任何这些修改以更改 ctime
。
您无法通过普通方式更改ctime。这是设计使然:
The ctime is always updated to the current when you change any of the
file's metadata, and there is no way to impose a different ctime.
要更改文件的 ctime,您可以:
- 将系统时间设置为你想强加的ctime,然后点击
文件,然后重置系统时间。
是否可以将文件的 ctime 设置为所需的值。我正在处理还原脚本,我需要在还原文件后将文件的 ctime 设置为以前的时间戳。
我试过touch
函数,但它只设置了atime和mtime。
ctime
is the inode or file change time. Thectime
gets updated when the file attributes are changed, like changing the owner, changing the permission or moving the file to an other filesystem but will also be updated when you modify a file.
因此您需要对文件执行任何这些修改以更改 ctime
。
您无法通过普通方式更改ctime。这是设计使然:
The ctime is always updated to the current when you change any of the file's metadata, and there is no way to impose a different ctime.
要更改文件的 ctime,您可以:
- 将系统时间设置为你想强加的ctime,然后点击 文件,然后重置系统时间。