I have a directory on an ext4 filesystem full of files that I may want to modify, for trivial adjustments such as the wrong database name in PHP files. However I wish to preserve the last-modified date. Is this possible, and if so, how?
Asked
Active
Viewed 537 times
0
-
You mean the file's mtime? Renaming only affects the atime, because you're changing inode data, not the file's actual content. – Marc B Jun 23 '13 at 20:26
-
But if I were changing the database name, I would be modifying the actual content of the file... – Fela Maslen Jun 23 '13 at 20:27
-
then yes, you're modifying the file's contents. so yes, the mtime will change. any reason you need it to stay constant? – Marc B Jun 23 '13 at 20:28
-
I want to know when the files were last "properly" modified, i.e. significantly modified (when they were developed) – Fela Maslen Jun 23 '13 at 20:28
-
then you should be using source control, and keep such "trivial" change information in the change logs. e.g. make it a v0.0.1 modification, instead of 0.1 or 1.0 – Marc B Jun 23 '13 at 20:29
-
I need to research that now – Fela Maslen Jun 23 '13 at 20:30
1 Answers
1
You can't "freeze" them, but you can record them, and then re-apply them using touch.
That said: using a version control system as suggested by Marc is definitely the way to go.

tink
- 14,342
- 4
- 46
- 50