note 24856 deleted from ref.dir by didou

From: Date: Thu, 29 May 2003 22:20:55 +0000
Subject: note 24856 deleted from ref.dir by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-49351@lists.php.net to get a copy of this message
Note Submitter: jmb@writeme.com ---- Small script to list all files + size + date (like the DOS dir command) //define the path as relative $path = "."; //using the opendir function $dir_handle = @opendir($path) or die("Unable to open $path"); //make string with 70 spaces $space=" "; echo "<PRE>"; echo "Directory Listing of $path\n"; //running the while loop while ($file = readdir($dir_handle)) { // filename - output left-justified $t="<a href=$file>$file</a>"; echo $t.substr($space,0,40-strlen($file)) ; // filesize - output right-justified $t=(filesize($file)/1024); $t=sprintf("%01.2f",$t)."kb "; echo substr($space,0,10-strlen($t)) . $t ; // filedate - output left-justified $t=date("d.M Y H:i:s", filemtime($file)); echo $t.substr($space,0,20-strlen($file)) ; echo "\n"; } //closing the directory closedir($dir_handle); echo "</PRE>";

« previous php.notes (#49351) next »