Change file creation date on Windows with PHP
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:
- nircmdc.exe is the command line version of nircmd (note the additional
c
before.exe
) - setfilefoldertime is a nircmd sub-command, it is documented here.
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
Win32 Console ToolBox 1.1
exec('touch.exe /c /t "file.html" '. date('H:i:s'));
nircmdc -> is to powerful