Search
Syndication
Sponsors

File Details

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)


File Details using the RecursiveDirectoryIterator class

<?php
//change the $dir to a directory on your system
//This was a directory on my test Windows XP machine
$dir = new RecursiveDirectoryIterator(’C:\test’);
$totalSize = 0;
foreach (new RecursiveIteratorIterator($dir) as $file)
{
    //$totalSize += $file->getSize();
 print “Name : $file” . “<br>”;
 print “Size : ” . $file->getSize() . ” bytes<br>”;
 print “Type : ” . $file->getType() . “<br>”;
 print “Path : ” . $file->getPath() . “<br>”;
 print “Path Name : ” . $file->getPathName() . “<br>”;
 print “<br>”;
}

?>

Related posts:

  1. File list of a folder <?php //folder to check $folder = “C:/xampp/htdocs/xampp/wordpress/wp-includes”; $handle = opendir($folder);...
  2. FTP file upload example upload a single file to a FTP server // FTP...
  3. Delete files that are over 7 days old <?php $dir = ‘/path/to/dir’; if ($handle = opendir($dir)) {  ...
  4. Manual Installation Tutorial for PHP 5 on IIS 5.1 (Windows XP Pro) Before we begin any installation steps, the first thing we...
  5. create a gzip file this example backs up the index.php as a gzip file...

Related posts brought to you by Yet Another Related Posts Plugin.



Tags:

Leave a Reply