date - Copy and rename PHP script -
i'm making script copies file direction , renames in there date stamp. got far:
<?php copy('test.xlsx', 'date/test.xlsx'); $filename = 'date/test.xlsx'; if (file_exists($filename)) { $date = new datetime(); rename("date/test.xlsx", "date/test " . $date->format('y-m-d') . ".xlsx"); echo "rename done"; } else { echo "file not found"; } ?>
it gives me error cant find script.php (line 15) line 15: rename("date/test.xlsx", "test " . $date->format('y-m-d') . ".xlsx");
don't know whats wrong because first time in php me looked on internet cant find hope guys can me out. thanks.
i edited file of comments rizier , made file.
<?php copy('test.xlsx', 'date/test.xlsx'); $filename = 'date/test.xlsx'; if (file_exists($filename)) { $date = new datetime(); rename("date/test.xlsx", "date/test " . $date->format('y-m-d') . ".xlsx"); echo "rename done"; } else { echo "file not found"; } ?>
answer made razier pasted in file can use it.
Comments
Post a Comment