2000 and (int)$any < 2100 and (int)$any > (int)$max_any) { $max_any = $any; } } closedir($anys); if ($max_any === '0000') { $data = date('YmdHi'); } else { $mesos = opendir("$max_any"); $max_mes = '00'; while (false !== ($mes = readdir($mesos))) { if (is_dir("$max_any/$mes") and (int)$mes > 0 and (int)$mes < 13 and (int)$mes > (int)$max_mes) { $max_mes = $mes; } } closedir($mesos); if ($max_mes === '00') { $data = date('YmdHi'); } else { $dies = opendir("$max_any/$max_mes"); $max_dia = '0000'; while (false !== ($dia = readdir($dies))) { if (is_dir("$max_any/$max_mes/$dia") and (int)$dia > 0 and (int)$dia < 1232 and (int)$dia > (int)$max_dia) { $max_dia = $dia; } } closedir($dies); if ($max_dia === '0000') { $data = date('YmdHi'); } else { $ls = explode("\n", trim(`/bin/ls -X -1 $max_any/$max_mes/$max_dia/$max_dia??????.jpg`)); if ($sls = sizeof($ls)) { $data = $max_any . substr($ls[$sls -1], 13, 8); } else { $data = date('YmdHi'); } } } } return $data; } ?>