0 || strpos(urldecode($arg), "^") !== false || strpos(urldecode($arg), "\\") !== false || strpos(urldecode($arg), "/") !== false)) { $cldone=true; if (urldecode($arg) != "") { if ($upto == 2) { $putthisback=urldecode($arg); $upto=3; } else if ($upto == 3) { $asteriskybit=urldecode($arg); $upto=6; } else { $aparts=explode("^", urldecode($arg)); if (sizeof($aparts) >= 3) { $upto=6; $dprefix=$aparts[0] . $aparts[1]; $asteriskybit=$aparts[2]; if (strpos($dprefix, "/") !== false) { $putthisback=explode("/",$dprefix)[-1 + sizeof(explode("/",$dprefix))]; } else if (strpos($dprefix, "\\") !== false) { $putthisback=explode("\\",$dprefix)[-1 + sizeof(explode("\\",$dprefix))]; } } else if (sizeof($aparts) == 2) { $upto=3; $dprefix=$aparts[0] . $aparts[1]; if (strpos($dprefix, "/") !== false) { $upto=3; $putthisback=explode("/",$dprefix)[-1 + sizeof(explode("/",$dprefix))]; if (strpos($putthisback, "[") !== false) { $upto=6; $sput=explode("[",$putthisback[0]); $asteriskybit=substr($putthisback,strlen($sput)); $putthisback=$sput; } } else if (strpos($dprefix, "\\") !== false) { $upto=3; $putthisback=explode("\\",$dprefix)[-1 + sizeof(explode("\\",$dprefix))]; if (strpos($putthisback, "[") !== false) { $upto=6; $sput=explode("[",$putthisback[0]); $asteriskybit=substr($putthisback,strlen($sput)); $putthisback=$sput; } } } else if (substr($arg,-1) == "\\" || substr($arg,-1) == "/") { $upto=2; $dprefix=$aparts[0]; if (strpos($dprefix, "/") !== false) { $upto=3; $putthisback=explode("/",$dprefix)[-1 + sizeof(explode("/",$dprefix))]; if (strpos($putthisback, "[") !== false) { $upto=6; $sput=explode("[",$putthisback[0]); $asteriskybit=substr($putthisback,strlen($sput)); $putthisback=$sput; } } else if (strpos($dprefix, "\\") !== false) { $upto=3; $putthisback=explode("\\",$dprefix)[-1 + sizeof(explode("\\",$dprefix))]; if (strpos($putthisback, "[") !== false) { $upto=6; $sput=explode("[",$putthisback[0]); $asteriskybit=substr($putthisback,strlen($sput)); $putthisback=$sput; } } if (strpos($dprefix, "/") !== false) { $upto=3; $putthisback=explode("/",$dprefix)[-1 + sizeof(explode("/",$dprefix))]; if (strpos($putthisback, "[") !== false) { $upto=6; $sput=explode("[",$putthisback[0]); $asteriskybit=substr($putthisback,strlen($sput)); $putthisback=$sput; } } else if (strpos($dprefix, "\\") !== false) { $upto=3; $putthisback=explode("\\",$dprefix)[-1 + sizeof(explode("\\",$dprefix))]; if (strpos($putthisback, "[") !== false) { $upto=6; $sput=explode("[",$putthisback[0]); $asteriskybit=substr($putthisback,strlen($sput)); $putthisback=$sput; } } } else if (strpos($arg,"\\") !== false || strpos($arg,"/") !== false) { $upto=2; $dprefix=$aparts[0]; if (strpos($dprefix, "/") !== false) { $upto=3; $putthisback=explode("/",$dprefix)[-1 + sizeof(explode("/",$dprefix))]; if (strpos($putthisback, "[") !== false) { $upto=6; $sput=explode("[",$putthisback[0]); $asteriskybit=substr($putthisback,strlen($sput)); $putthisback=$sput; } } else if (strpos($dprefix, "\\") !== false) { $upto=3; $putthisback=explode("\\",$dprefix)[-1 + sizeof(explode("\\",$dprefix))]; if (strpos($putthisback, "[") !== false) { $upto=6; $sput=explode("[",$putthisback[0]); $asteriskybit=substr($putthisback,strlen($sput)); $putthisback=$sput; } } } } } } } } else { // surfing the net usage if (isset($_GET['dirone']) && isset($_GET['dirtwo'])) { $dprefix=urldecode($_GET['dirone']) . urldecode($_GET['dirtwo']); if (substr($dprefix, -1) != "/" && substr($dprefix, -1) != "\\") { if (strpos($dprefix, "/") !== false) { $putthisback=explode("/",$dprefix)[-1 + sizeof(explode("/",$dprefix))]; } else if (strpos($dprefix, "\\") !== false) { $putthisback=explode("\\",$dprefix)[-1 + sizeof(explode("\\",$dprefix))]; } } } else if (isset($_POST['dirone']) && isset($_POST['dirtwo'])) { $dprefix=urldecode($_POST['dirone']) . urldecode($_POST['dirtwo']); if (substr($dprefix, -1) != "/" && substr($dprefix, -1) != "\\") { if (strpos($dprefix, "/") !== false) { $putthisback=explode("/",$dprefix)[-1 + sizeof(explode("/",$dprefix))]; } else if (strpos($dprefix, "\\") !== false) { $putthisback=explode("\\",$dprefix)[-1 + sizeof(explode("\\",$dprefix))]; } } } if (isset($_GET['asteriskybit'])) { $asteriskybit=urldecode($_GET['asteriskybit']); } else if (isset($_POST['asteriskybit'])) { $asteriskybit=urldecode($_POST['asteriskybit']); } } $cnt=0; $recnt=0; $extarr=[]; $extarrlongestnumerical=[]; $changesfrom=[]; $changesto=[]; $fileis=[]; $categoryis=[]; $numcis=[]; $extlist=","; $ext_nl_list=","; $ext_nf_list=","; $ext_dl_list=","; $ext_fo_list=","; if (isset($_POST['donothing']) || isset($_GET['donothing'])) { // Do nothing $htmlis="Rename to Aid Sorting Candidates - RJM Programming - April, 2018

"; } else if (isset($_POST['cmd']) && isset($_POST['infile']) && isset($_POST['outfile'])) { // Perform rename if (strpos(strtoupper(('' . PHP_OS)), "WINDOW") !== false && strpos($_SERVER['SERVER_NAME'],"rjmprogramming.com.au") === false) { if (file_exists(urldecode($_POST['infile']))) { if (!file_exists(urldecode($_POST['outfile']))) { if (strpos("~" . str_replace("m" . "v " . "", "ren" . "ame ",urldecode($_POST['cmd'])), "~ren" . "ame " . urldecode($_POST['infile']) . " ") !== false) { exec(urldecode($_POST['cmd'])); if (file_exists(urldecode($_POST['outfile']))) { $htmlis="Rename to Aid Sorting Candidates - RJM Programming - April, 2018

" . urldecode($_POST['cmd']) ."
rem Command successful

"; } else { $htmlis="Rename to Aid Sorting Candidates - RJM Programming - April, 2018

Sorry, but the following command does not work ... " . urldecode($_POST['cmd']) ."

"; } } else { $htmlis="Rename to Aid Sorting Candidates - RJM Programming - April, 2018

Sorry, but cannot do " . urldecode($_POST['cmd']) . "

"; } } else { $htmlis="Rename to Aid Sorting Candidates - RJM Programming - April, 2018

Sorry, but " . urldecode($_POST['outfile']) . " already exists.

"; } } else { $htmlis="Rename to Aid Sorting Candidates - RJM Programming - April, 2018

Sorry, btt " . urldecode($_POST['infile']) . " does not exist.

"; } } else if (strpos(strtoupper(('' . PHP_OS)), "WINDOW") !== false) { exit; } else if (strpos($_SERVER['SERVER_NAME'],"rjmprogramming.com.au") === false) { if (file_exists(urldecode($_POST['infile']))) { if (!file_exists(urldecode($_POST['outfile']))) { if (strpos("~" . str_replace("m" . "v " . "", "ren" . "ame ",urldecode($_POST['cmd'])), "~ren" . "ame " . urldecode($_POST['infile']) . " ") !== false) { exec(urldecode($_POST['cmd'])); if (file_exists(urldecode($_POST['outfile']))) { $htmlis="Rename to Aid Sorting Candidates - RJM Programming - April, 2018

" . urldecode($_POST['cmd']) ." # Command successful

"; } else { $htmlis="Rename to Aid Sorting Candidates - RJM Programming - April, 2018

Sorry, but the following command does not work ... " . urldecode($_POST['cmd']) ."

"; } } else { $htmlis="Rename to Aid Sorting Candidates - RJM Programming - April, 2018

Sorry, but cannot do " . urldecode($_POST['cmd']) . "

"; } } else { $htmlis="Rename to Aid Sorting Candidates - RJM Programming - April, 2018

Sorry, but " . urldecode($_POST['outfile']) . " already exists.

"; } } else { $htmlis="Rename to Aid Sorting Candidates - RJM Programming - April, 2018

Sorry, but " . urldecode($_POST['infile']) . " does not exist. after " . urldecode($_POST['cmd']) . "

"; } } else { exit; } } if ($htmlis == "") { // Analyze $htmlis="Rename to Aid Sorting Candidates - RJM Programming - April, 2018

Rename to Aid Sorting Candidates

RJM Programming - April, 2018

Existing Filename
in " . str_replace($putthisback,"",$dprefix) . "
satisfying " . $putthisback . $asteriskybit . "
Could Rename to Aid
With Numerical File Sorts
Make That Happen?
Relative to This Program Directory:

Filename Prefix (that File Filter does not apply to):

File Filter:

"; foreach (glob($dprefix . $asteriskybit) as $filename) { //echo $filename . "\n"; //$htmlis=str_replace("","\n" . str_replace($dprefix, "", $filename) . "\n",$htmlis); $thisext="." . explode(".", str_replace($dprefix, "", $filename))[-1 + sizeof(explode(".", str_replace($dprefix, "", $filename)))]; $nfields=1; $ncnt=0; $delimis="."; while (substr(str_replace($dprefix, "", $filename),$ncnt,1) >= '0' && substr(str_replace($dprefix, "", $filename),$ncnt,1) <= '9') { $ncnt++; } if (substr(str_replace($dprefix, "", $filename),$ncnt,1) != '.') { $delimis=substr(str_replace($dprefix, "", $filename),$ncnt,1); $nfs=explode(substr(str_replace($dprefix, "", $filename),$ncnt,1), str_replace($dprefix, "", $filename)); $nfields=sizeof($nfs); } $fileis[sizeof($fileis)]=str_replace($dprefix, "", $filename); $categoryis[sizeof($categoryis)]=$thisext . "." . $nfields . ";" . $delimis; $numcis[sizeof($numcis)]=$ncnt; $extarrlongestnumerical[sizeof($extarrlongestnumerical)]=$ncnt; $extarr[sizeof($extarr)]=$thisext; if (strpos($extlist, "," . $thisext . "." . $nfields . ";" . $delimis . ",") === false) { //echo str_replace($dprefix, "", $filename) . " ... " . $ncnt . "?" . $thisext . "." . $nfields . ";" . $delimis; //exit; $extlist.=$thisext . "." . $nfields . ";" . $delimis . ","; $ext_nl_list.="" . $ncnt . ","; // count of numbers before delimiter happens $ext_nf_list.="" . $nfields . ","; // count of fields of delimiter below $ext_dl_list.="" . $delimis . ","; // delimiter $ext_fo_list.="" . str_replace($dprefix, "", $filename) . ","; // first filename example //$fileis[sizeof($fileis)]=str_replace($dprefix, "", $filename); //$categoryis[sizeof($categoryis)]=$thisext . "." . $nfields . ";" . $delimis; //$numcis[sizeof($numcis)]=$ncnt; } else { $xxsl=sizeof(explode(",", explode("," . $thisext . "." . $nfields . ";" . $delimis . ",", $extlist)[0])); $vsx=explode(",", $ext_nl_list); if ($vsx[$xxsl] != $ncnt) { //$fileis[sizeof($fileis)]=str_replace($dprefix, "", $filename); //$categoryis[sizeof($categoryis)]=$thisext . "." . $nfields . ";" . $delimis; //$numcis[sizeof($numcis)]=$ncnt; if ($ncnt < $vsx[$xxsl]) { $changesfrom[sizeof($changesfrom)]=str_replace($dprefix, "", $filename); $prefix=""; while ($ncnt < $vsx[$xxsl]) { $prefix.="0"; $ncnt++; } $changesto[sizeof($changesto)]=$prefix . str_replace($dprefix, "", $filename); //echo "0 " . $prefix . str_replace($dprefix, "", $filename) . $xxsl . "
" . explode(",",$ext_fo_list)[$xxsl] . "
" . $thisext . "." . $nfields . ";" . $delimis . "
" . str_replace($dprefix, "", $filename) . " \$vsx[\$xxsl]=" . $vsx[$xxsl] . " and \$ncnt=" . $ncnt . " ... " . $ext_fo_list; // //$ext_nl_list[$xxsl].=";" . $nfields; //exit; } else { $recon=$vsx[0]; for ($ivi=1; $ivi 3) { //echo $thisext . "." . $nfields . ";" . $delimis . " changing from " . $vsx[$ivi] . " to " . $ncnt . "
" . $extlist . "
" . $ext_nl_list . "
to
" . $recon; //exit; //} $ext_nl_list=$recon; //$fileis[sizeof($fileis)]=str_replace($dprefix, "", $filename); //$categoryis[sizeof($categoryis)]=$thisext . "." . $nfields . ";" . $delimis; //$numcis[sizeof($numcis)]=$ncnt; for ($ii=0; $ii" . explode(",",$ext_fo_list)[$xxsl] . "
" . $thisext . "." . $nfields . ";" . $delimis . "
" . str_replace($dprefix, "", $filename) . " \$vsx[\$xxsl]=" . $vsx[$xxsl] . " and \$ncnt=" . $ncnt . " ... " . $ext_fo_list; // //$ext_nl_list[$xxsl].=";" . $nfields; //exit; } } } $cnt++; } foreach (glob($dprefix . $asteriskybit) as $filename) { //$htmlis=str_replace("","\n" . str_replace($dprefix, "", $filename) . "\n",$htmlis); $found=false; $newf=""; $newcb=""; for ($iu=(-1 + sizeof($changesfrom)); $iu>=0; $iu--) { if (!$found) { if ($fileis[$recnt] == $changesfrom[$iu] && $changesto[$iu] != $fileis[$recnt] && trim($changesto[$iu]) != "" && strpos($changesto[$iu],".") !== false) { //$newf=$putthisback . $changesto[$iu]; $newf=""; if ($argv || (isset($_GET['inspec']) && !isset($_GET['dirone']) && !isset($_GET['dirtwo']))) { if (strpos(strtoupper(('' . PHP_OS)), "WINDOW") !== false) { $newcb="\nrename " . qi($dprefix . $fileis[$recnt]) . " " . qi($putthisback . $changesto[$iu]) . "\n"; } else { $newcb="\nmv " . qi($dprefix . $fileis[$recnt]) . " " . qi($dprefix . $changesto[$iu]) . "\n"; } } else if (strpos(strtoupper(('' . PHP_OS)), "WINDOW") !== false && strpos($_SERVER['SERVER_NAME'],"rjmprogramming.com.au") === false) { $newcb='
Rename file at left
to name at right
"; $htmlis=str_replace(" Rename file at left
to name at right "; $htmlis=str_replace("","\n" . $putthisback . $fileis[$recnt] . "" . $newf . "" . $newcb . "\n",$htmlis); $recnt++; } } } //echo sizeof($fileis); if ($argv || (isset($_GET['inspec']) && !isset($_GET['dirone']) && !isset($_GET['dirtwo']))) { // command line or curl ... just show commands for user to try or not ... they may want a pipe like " | tee do_these_renames.ksh" (and then follow up "ksh -x do_these_renames.ksh") $outp=""; if (strpos(strtoupper(('' . PHP_OS)), "WINDOW") !== false) { $lines=explode("\nren" . "ame "); for ($oi=1; $oi