Re: Reading Directories
| From: | Phillip S. Baker | Date: | Mon, 07 Aug 2000 20:09:02 +0000 |
| Subject: | Re: Reading Directories | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-10530@lists.php.net to get a copy of this message | ||
Thanks for the tip. Got it to work using the full directory path and quote in the is_dir function.
Is there a way to alphabetize the output?
Phillip
At 10:07 PM +0200 8/7/00, Patrick Meisel wrote:
Hi, you can use if(is_dir($entry)) before creating the link. http://www.php.net/manual/function.is-dir.php PatrickGreetings 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