Tema: FTP fecha
Ver Mensaje Individual
  #3 (permalink)  
Antiguo 25/03/2014, 05:24
taurojo
 
Fecha de Ingreso: enero-2014
Ubicación: alicante
Mensajes: 28
Antigüedad: 10 años, 3 meses
Puntos: 1
Respuesta: FTP fecha

Bueno

No había olvidado <quimfv> mil gracias, solo que que me ha sido imposible hacer el array.

Al hacer esto me devolvía un " No se pudo obtener mdtime", por lo que me olvido de este tipo de solución, aunue luego con un array_merge() imagino que funcionaria:
Código PHP:
    // NOS TRAEMOS EL CONTENIDO DE LOS MP4
        
                
include('conex_ftp.php');
                        
                
//Obtenemos el listado del directorio de TELEDIFUSIÓN
                //////// CONTENIDOS DEL FTP_FICHEROS
                
$list_ficheros = array();         
                
$list_ficheros ftp_nlist($x,"*.mp4");
                
//////// CONTENIDOS DEL FTP_FECHAS POR ÚLTIMA MODIFICACIÓN
                
$list_fechasmod = array(); 
                
$list_fechasmod=ftp_mdtm($x,"*.mp4");
                
//comprobamos si se puede obdener el mdtm devuelve -1
                
                
if ($list_fechasmod != -1) {
                
// somefile.txt fue modificado por última vez en: March 26 2003 14:16:41.
                
echo "$file fue modificado por última vez en : " date("F d Y H:i:s."$list_fechasmod);
            } else {
                echo 
"No se pudo obtener mdtime";
            } 


Finalmente lo solucione gracias al santo manual:
http://www.php.net/manual/en/function.ftp-rawlist.php

Y así se me ha quedado mi código:

Código PHP:

<?php    

        
// NOS TRAEMOS EL CONTENIDO DE LOS MP4
        
include('conex_ftp.php');

                
$rawfiles ftp_rawlist($x"*.mp4"true);                                    
$structure = array();
$arraypointer = &$structure;
 foreach (
$rawfiles as $rawfile) {
     if (
$rawfile[0] == '/') {
         
$paths array_slice(explode('/'str_replace(':'''$rawfile)), 1);
         
$arraypointer = &$structure;
         foreach (
$paths as $path) {
             foreach (
$arraypointer as $i => $file) {
                 if (
$file['text'] == $path) {
                     
$arraypointer = &$arraypointer$i ]['children'];
                     break;
                 }
             }
         }
     } elseif(!empty(
$rawfile)) {
         
$info preg_split("/[\s]+/"$rawfile9);        
         
$arraypointer[] = array(
             
'text'   => $info[8],
             
'isDir'  => $info[0]{0} == 'd',
             
'size'   => byteconvert($info[4]),
             
'chmod'  => chmodnum($info[0]),
             
'date'   => strtotime($info[6] . ' ' $info[5] . ' ' $info[7]),
             
'raw'    => $info
         
);
             
// the 'children' attribut is automatically added if the folder contains at least one file
     
}
 }

 
 
/// PARA AJUSTAR TAMAÑO 
function byteconvert($bytes) {
     
$symbol = array('B''KB''MB''GB''TB''PB''EB''ZB''YB');
     
$exp floorlog($bytes) / log(1024) );
     return 
sprintf'%.2f ' $symbol$exp ], ($bytes pow(1024floor($exp))) );
 }

 
 
/// PARA VER MEJOR LOS PERMISOS:
 
function chmodnum($chmod) {
     
$trans = array('-' => '0''r' => '4''w' => '2''x' => '1');
     
$chmod substr(strtr($chmod$trans), 1);
     
$array str_split($chmod3);
     return 
array_sum(str_split($array[0])) . array_sum(str_split($array[1])) . array_sum(str_split($array[2]));
 }

   
 
 echo 
"<B><CENTER>CONTENIDOS DEL RAIZ </CENTER></B><br>"
 
 for ( 
$i 1$i count($structure); $i++ ) {
?>
<table border=1>
    <td><?php echo $structure[$i][text]; //nombre ?></td>
    <td><?php echo $structure[$i][size]; //tamaño ?></td>
    <td><?php echo $structure[$i][raw][7]."  ".$structure[$i][raw][6]."/".$structure[$i][raw][5]; // HORA DIA Y MES ?></td>
 </table>

  <?php
  
}

        
                                            
// Cerramos la conexión FTP        
ftp_quit($x);
?>

Mucho más complejo y lento, eso sí tengo casi toda la información :D....

Gracias a todos