In php I can change the file last modification and access time arbitrarily with touch()
<?php
touch($filename,mktime(0,0,0,2010,1,10));
...but how to change the creation time ?
Why do I need this? Well, If I retrodate a file or a directory mtime to before their creation date, explorer.exe
keeps showing me the more recent creation date instead.
Mh, an unsatisfactory, but working, approach I found out about, is: using nircmd .
Nircmd is a 37kb utility. (redistributable, closed-source , freeware)
How to proceed:
<?php
$time=strftime('%d-%m-%Y %H:%M:%S',$time);
$cmd=".\\nircmdc.exe setfilefoldertime \"$filename\" \"$time\"";
system($cmd);
Notes:
c
before .exe
) Still, I hope there is a COM or WMIC solution I couldn't find this time around.
Try this one you can change file creation time and modify time
exec('touch.exe /c /t "file.html" '. date('H:i:s'));
nircmdc -> is to powerful
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.