php leer directorio y fecha de salida modificada para carpeta

I have a working code that Reads a directory and outputs the name, total files y size already. What I would like to do is also grab the Date Modified and format it as YYYY-MM-DD.

Código:

if ($handle = opendir('D:/'.$sub.'/')) {

    while (false !== ($entry = readdir($handle))) {
        if ($entry != '$RECYCLE.BIN' && $entry != 'System Volume Information' && $entry != '.' && $entry != '..') {
        $exists = mysql_query('SELECT * FROM comics WHERE arc LIKE "'.$entry.'%"');
        $exists1 = mysql_num_rows($exists);
            if ($exists1 == 0) {
            $directory = $base.$sub."/".$entry;
            $filecount = count(glob($directory."/"."*.*"));
            $size = 0; 
            $d = new RecursiveIteratorIterator( 
            new RecursiveDirectoryIterator($directory),  
            RecursiveIteratorIterator::SELF_FIRST 
            ); 

            foreach($d as $file){ 
            $size += $file->getSize(); 
            } 

            $entry = str_replace(" - ", ": ", $entry);
                mysql_query('INSERT INTO comics (arc, files, size) VALUES ("'.$entry.'\n", "'.$filecount.'", "'.$size.'")');
                print "<li>Inserted <b>".$entry."</b> With A File Count Of <b>".$filecount."</b> & A Total Size Of <b>".$size."</b> Bytes.</li>";
            }
        }
    }
}

preguntado el 09 de marzo de 12 a las 14:03

1 Respuestas

if (file_exists($filename)) {
    echo "$filename was last modified: " . date ("Y-m-d", filemtime($filename));
}

http://php.net/manual/en/function.filemtime.php

respondido 09 mar '12, 14:03

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.