Re: Reading Directories

From: Date: Mon, 07 Aug 2000 20:07:39 +0000
Subject: Re: Reading Directories
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-10529@lists.php.net to get a copy of this message
Hi, you can use if(is_dir($entry)) before creating the link. http://www.php.net/manual/function.is-dir.php Patrick > > 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

« previous php.general (#10529) next »