= 'a' && substr($goes, $ii, 1) <= 'z') {
$xgoes.="[a-z]";
} else if (substr($goes, $ii, 1) >= 'A' && substr($goes, $ii, 1) <= 'Z') {
$xgoes.="[A-Z]";
} else if (substr($goes, $ii, 1) >= '0' && substr($goes, $ii, 1) <= '9') {
$xgoes.="[0-9]";
} else {
$xgoes.=substr($goes, $ii, 1);
}
}
$extension=".xml";
if (isset($_GET['extension'])) {
$extension=str_replace("+"," ",urldecode($_GET['extension']));
} else if (isset($_POST['extension'])) {
$extension=str_replace("+"," ",urldecode($_POST['extension']));
}
$doit=true;
$couldhave="";
if (isset($_GET['preview'])) {
$doit=false;
$couldhave="could have ";
} else if (isset($_POST['preview'])) {
$doit=false;
$couldhave="could have ";
}
if (isset($_GET['path'])) {
$path=str_replace("+"," ",urldecode($_GET['path']));
$htmlis="
Rename Report ...
Filename: act-1989-76-2017-07-01.xml ... replace act- with ACT~AUS~NSW~Y. and delete the date at the end -2017-07-01 ... this will vary with each file
";
foreach (glob($path . $prefix . "*" . $xgoes . $extension) as $xmlfil) {
$predotxml=explode($extension, $xmlfil);
$postdotxml=explode($prefix, substr($predotxml[0],0,(strlen($predotxml[0]) - strlen($goes))));
$renfile=$postdotxml[0] . $newprefix . $postdotxml[1] . $extension;
$htmlis=str_replace("", "
File candidate called " . $xmlfil . " found that we " . $couldhave . "renamed to " . $renfile . "", $htmlis);
if ($doit) { rename($xmlfil, $renfile); }
}
echo $htmlis;
exit;
} else if (isset($_POST['path'])) {
$path=str_replace("+"," ",urldecode($_POST['path']));
$htmlis="Rename Report ...
Filename: act-1989-76-2017-07-01.xml ... replace act- with ACT~AUS~NSW~Y. and delete the date at the end -2017-07-01 ... this will vary with each file
";
foreach (glob($path . $prefix . "*" . $xgoes . $extension) as $xmlfil) {
$predotxml=explode($extension, $xmlfil);
$postdotxml=explode($prefix, substr($predotxml[0],0,(strlen($predotxml[0]) - strlen($goes))));
$renfile=$postdotxml[0] . $newprefix . $postdotxml[1] . $extension;
$htmlis=str_replace("", "
File candidate called " . $xmlfil . " found that we " . $couldhave . "renamed to " . $renfile . "", $htmlis);
if ($doit) { rename($xmlfil, $renfile); }
}
echo $htmlis;
exit;
} else {
if (!isset($_GET['nothing'])) {
$htmlis="Rename Run ...
Filename: act-1989-76-2017-07-01.xml ... replace act- with ACT~AUS~NSW~Y. and delete the date at the end -2017-07-01 ... this will vary with each file