Reading Directories
| From: | Phillip S. Baker | Date: | Mon, 07 Aug 2000 19:45:52 +0000 |
| Subject: | Reading Directories | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-10527@lists.php.net to get a copy of this message | ||
Greetings All,
I am creating a script that reads the contents of a directory. However I only want it to read the names of the directories and not the files that are in a particular directory.
I have this bit of code.
<?php
$d = dir("some_dir/");
while($entry=$d->read())
{
if ($entry != "." && $entry != "..")
{
echo "<A HREF=\"track_list.php3\">$entry</A><BR>\n";
}
}
$d->close();
?>
Now the files that I have in some_dir are listed as.
new_dir/
another_dir/
file.txt
anotherfile.bat
I only want to above script to display
new_dir
another_dir
How do I go about doing that?
--
Phillip S. Baker
phillip@wordsandimages.com
Words & Images, Inc.
1535 Seabright Avenue, Suite 100, Santa Cruz, CA 95062
Direct Line (831) 420-2641 / Fax (831) 458-0808