
<?php

function deleteDirectory($dir) {
    if (!is_dir($dir)) return false;

    $items = new RecursiveIteratorIterator(
        new RecursiveDirectoryIterator($dir, RecursiveDirectoryIterator::SKIP_DOTS),
        RecursiveIteratorIterator::CHILD_FIRST
    );

    foreach ($items as $item) {
        if ($item->isDir()) {
            rmdir($item->getPathname());
        } else {
            unlink($item->getPathname());
        }
    }

    return rmdir($dir);
}

function findAndDeleteDocuDirs($basePath) {
    $iterator = new RecursiveIteratorIterator(
        new RecursiveDirectoryIterator($basePath, RecursiveDirectoryIterator::SKIP_DOTS),
        RecursiveIteratorIterator::CHILD_FIRST
    );

    foreach ($iterator as $item) {
        if ($item->isDir() && basename($item->getPathname()) === 'info') {
            echo "Eliminando: " . $item->getPathname() . PHP_EOL;
            deleteDirectory($item->getPathname());
        }
    }
}

// 🔧 Cambia esta ruta a donde quieres buscar
$path = '../';  // Ejemplo: '/home'

// Ejecutar
findAndDeleteDocuDirs($path);

?>
die();

<?php

// die();
$numero=1001;
// if($cfg_empr=='pcs1')
if($cfg_empr=='imcp')
{
     $sql_updt='update cont1 set status="X" where status="O" and docu like "DD%"';
     $res_updt=msql_query($sql_updt,$link_data);
     
     
     $sql_cont='select * from cont1 where ifnull(status,"")not in ("O","X") and docu like "DD10%" order by fecha, idnum1 ';
     $res_cont=msql_query($sql_cont,$link_data);
     
     while($aso_cont=msql_fetch_assoc($res_cont))
     {
          $sql_updt='update cont1 set ptoe="001001", numero = "'.sprintf("%09d", $numero).'" where idnum1="'.$aso_cont['idnum1'].'"';
          $res_updt=msql_query($sql_updt,$link_data);
          echo '<br>=> '.$sql_updt;
          $numero++;
     }
     
     
}

?>


