RE: [PHP] How can i print out the files in a directory?[Scanned]

From: Date: Fri, 17 Oct 2003 13:16:53 +0000
Subject: RE: [PHP] How can i print out the files in a directory?[Scanned]
Groups: php.general 
Request: Send a blank email to php-general+get-166456@lists.php.net to get a copy of this message
Bas, I think the following should work though it might need some tweaking as it's some weeks since I did: $dir = "directoryname"; $dp = opendir($dir); $filenames = array(); while($file = readdir($dp)) { array_push($filenames, $file); } // Compile an array of the files for($i = 0; $i < count($filenames); $i ++) { if(!(is_dir("$dir/$filenames[$i]"))) { echo $filenames[$i]."<br>"; } } You can probably print out the filenames at the first stage - I think there was a reason why I was passing them into a separate array but I've forgotten what it was!! Regards, Michael Egan -----Original Message----- From: Bas [mailto:bas_timmer49@hotmail.com] Sent: 17 October 2003 13:42 To: php-general@lists.php.net Subject: [PHP] How can i print out the files in a directory?[Scanned] How can i print out all of the files in a directory? I want some output as this: index.php login.php image1.gif image2.jpg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.general (#166456) next »