I tried to use
touch -d "2011-09-15 16:50" test.txt
but it just modifies the last access time and the last modified time.
Access: 2011-09-15 16:50:00.000000000 +0700
Modify: 2011-09-15 16:50:00.000000000 +0700
Change: 2011-11-15 16:56:55.620124149 +0700
How to change the last change time?
I want to do this because my crontab uses filectime($file)
to get the last changed time and I need to create a file of two months ago to test something.
There is no general command to do this. However, depending on the filesystem and your administrator privileges, you can do it.
Here is an answer for the case of ext2/3 and possibly ext4.