Re: Reading Directories

From: Date: Tue, 08 Aug 2000 10:21:35 +0000
Subject: Re: Reading Directories
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-10587@lists.php.net to get a copy of this message
Use the is_dir() function bool is_dir (string filename) > if ($entry != "." && $entry != ".." && is_dir($entry) > ) - cnb On Mon, 7 Aug 2000, Phillip S. Baker wrote: > 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? > --

« previous php.general (#10587) next »