<?php
//look in directory and grab the file starttoken.php
copy('tokenmaster/starttoken.php', './starttoken.php');
$filename = './starttoken.php';
if (file_exists($filename)) {
$date = new DateTime();
//add the date
rename("./starttoken.php", "./tokendone" . $date->format('ydhis') . ".php");
//echo "Rename done";
echo "";
} else {
echo "File not found";
}
?>
//at a loss to figure out how to create a new directory to place this file into.
//revision - while I can create the new folder now, it seems that my renamed file does not get placed into the new directory, just the root, I must be doing something wrong.
<?php
$store_path = './';
$name = date('Y-m-d H-i-s');
if(!is_dir($store_path.$name)) mkdir($store_path.$name);
copy('tokenmaster/starttoken.php', './starttoken.php');
$filename = './starttoken.php';
if (file_exists($filename)) {
$date = new DateTime();
rename("./starttoken.php", "./tokendone" . $date->format('ydhis') . ".php");
}
#... your code
#build your content and store it e.g. by
file_put_contents($store_path.$name.'/'.$filename, $yourcontent);
?>