Reputation: 35
I have some pictures in a folder and i rename them with PHP. Unfortunately the change Attribut is set to the current date and time. I just want to keep the original one. Is this possible?
Upvotes: 0
Views: 432
Reputation: 757
Before the rename command, get the file's existing modification time using the filemtime()
function, like this: $mtime = filemtime($file);
Then, after the rename command, set the modification time back to that value using the touch()
function, like this: touch($file, $mtime, $mtime);
Read more:
Upvotes: 2