ArchivedTools/ScanScripts/Windows/sort/forward.php
2023-12-21 02:01:29 +01:00

32 lines
543 B
PHP

<?php
$forward = glob('./forward/*.tif');
$backward = glob('./backward/*.tif');
rsort($backward);
$output = './output/';
$fcount = 1;
$bcount = 2;
if(!file_exists($output)) mkdir($output, 0777, true);
foreach($forward as $fk => $fv)
{
echo $fk . ' => ' . $fv . "\n";
copy($fv, $output . str_pad($fcount, 4, 0, STR_PAD_LEFT) . '.tif');
$fcount += 2;
}
foreach($backward as $bk => $bv)
{
if ($bk % 2 != 0)
{
echo $bk . ' => ' . $bv . "\n";
copy($bv, $output . str_pad($bcount, 4, 0, STR_PAD_LEFT) . '.tif');
$bcount += 2;
}
}
?>