I'm trying to move a file after a batch job e-mail has been sent into the "OLD" folder.
I have successfully determined the code to do so.  Right now the file is called monthly_mssql, I'm trying to rename the file to monthly_mssql_mmmyyyy.  
With the month and year added to the end of the file I can keep track of determining which reports are for which month. How would I edit the existing command file?
MY CODE FOR CMD FILE:
REM The report is generated automatically and must be sent at 9:50 AM of the first Monday of every month, file is located
REM in C:\Reports\mssql\Monthly_Stats
"C:\Program Files\xampp\php\php.exe" "c:\htdocs\MultipleReport\monthly_smurfreport_email.php"
move C:\Smurf_Reports\mssql\Monthly_Stats\monthly_mssql.csv C:\Smurf_Reports\mssql\Monthly_Stats\old
MY CODE FOR PHP FILE:
 $dirpath = "C:/Reports/mssql/Monthly_Stats/";
 if ($handle = opendir($dirpath  )) 
 {
$semi_rand = md5(time()); 
$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
$headers .= "\nMIME-Version: 1.0\n" .
        "Content-Type: multipart/mixed;\n" .
        " boundary=\"{$mime_boundary}\"";
$email_message = "This is a multi-part message in MIME format.\n\n" .
"--{$mime_boundary}\n" .
"Content-Type:text/html; charset=\"iso-8859-1\"\n" .
"Content-Transfer-Encoding: 8bit\n\n" .
$message_text . "\n\n";
$email_message .= "--{$mime_boundary}\n";
    /* This is the correct way to loop over the directory. */
    while (false !== ($entry = readdir($handle)))
{
    if (strpos($entry, '.csv',1))
    {
            $filepath = "";
        $filesize = 0;
        $filepath = $dirpath."".$entry; 
        $filesize = filesize ($filepath);          
        if (file_exists($filepath) && $filesize > 1)
        {
            $fileatt = $filepath;
            $fileatt_name = $entry;
            $fileatt_type = "application/octet-stream";
            $message_text .= "<P>Hi</P>";
            $file = fopen($fileatt,'rb');
            $data = fread($file,filesize($fileatt));
            fclose($file);
            $data = chunk_split(base64_encode($data));
                    $email_message .=  "Content-Type: {$fileatt_type};\n" .
                    " name=\"{$fileatt_name}\"\n" .
                    "Content-Disposition: attachment;\n" .
                    //" filename=\"{$fileatt_name}\"\n" .
                    "Content-Transfer-Encoding: base64\n\n" .
                    $data . "\n\n";
                    $email_message .= "--{$mime_boundary}\n";
        }
        $email_from = "k.j@yahoo.com";
// $email_to = "k.j@yahoo.com"; $email_to = "k.j@yahoo.com";
        $lastMonth = date('F-Y',strtotime('last month'));
        $email_subject = "($lastMonth) Report for MS-SQL.";
        $headers .= "From: ".$email_from."\r\n";
        echo $filepath."</br>";
    }
}
    closedir($handle);
    $ok = @mail($email_to, $email_subject, $email_message, $headers);
  }
 /*if (file_exists($filename) && $size > 228 && $EmailAdd <> "")
 {
$fileatt = $filename;
$fileatt_name = $groupname.".csv";
if ($uemail <> "")
$email_from = $uemail;
else
    $email_from = $username."@yahoo.com";
    $email_to = $email_from;
    $email_subject = " Messages for Priority '".$p."' - ".$groupname."  -      ".$displaydate;
    $headers .= "From: ".$email_from. "\r\n";
    $headers .= "Cc: ".$EmailAdd. "\r\n";
    $headers .= "Bcc: k.j@yahoo.com";
    $email_message .= "<P>Hi</P>";
    $email_message .= "<P><B>Please find attached Monthly Smurf Report         Stats."</U></B>\n";
    $email_message .= "<P><P>Thanks,<P>;
    set_error_handler("myErrorHandler");
    $ok = @mail($email_to, $email_subject, $email_message, $headers);
    if ($ok)
    {
        unlink($filename);
    }
        else
        {
        $file = "C:/Reports/Operation/Daily_Stats/smtperrlog.txt";
        $fh = fopen($file, 'r+');
        $contents = fread($fh, filesize($file));
        fclose($fh);
        $stderr = fopen   ('C:/Reports/Operation/Daily_Stats/smtperrlog.txt', 'w+');
        fwrite($stderr,"");
        fclose($stderr);
        $email_fromerr = "k.j@yahoo.com";
        $email_toerr = "k.j@yahoo.com";
        $email_subjecterr = "Monthly Stats";
        $email_messageerr = $contents;
        $headerserr .= "From: ".$email_fromerr. "\r\n";
        @mail($email_toerr, $email_subjecterr, $email_messageerr,  $headerserr);
        }
  }
  */
  $message_text = "";
  $p = "";
  $EmailAdd = "";
  $headers = "";
  $counter = 0;
 
    