2012-03-09 7 views
0

私はディレクトリを読み込み、name,total filessizeを既に出力している作業コードを持っています。私がやりたいことは、Date Modifiedをつかんで、YYYY-MM-DDと書式を設定することです。php読み込みディレクトリと出力日がフォルダのために変更されました

コード:

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>"; 
      } 
     } 
    } 
} 
+0

あなたがこの記事のint答えを見つけることができます:[http://stackoverflow.com/questions/2773009/can-we-get-the- directorys変性タイム・アンド・サイズすなわち、統計] [1] [1]:http://stackoverflow.com/questions/2773009/can-we-get-the-directorys-modified時間とサイズのie-stats – Kres

答えて

関連する問題