Re: code

From: Date: Sun, 15 Aug 2004 18:53:19 +0000
Subject: Re: code
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-193893@lists.php.net to get a copy of this message
On 14 Aug 2004 14:42:19 -0000, PHPDiscuss - PHP Newsgroups and mailing lists <jacobbbc@yahoo.co.in> wrote: > Codes attached. > In this page i used filetype instead of is_dir. > > <?php > $dir = "jdkcoders/"; > function getfiles($dir) > { > if (is_dir($dir)) { > if ($dh = opendir($dir)) { > while (($file = readdir($dh)) !== false) > { if($file!='.' && $file!='..') > { > if(filetype($dir . $file)=='dir') > { > getfiles($dir."/".$file); Look at the two above lines. One adds a '/' and the other diesn't. Try adding it to the first one. > } > else > { > > echo "<br>$file"; > > } > } > } > closedir($dh); > } > } > } > getfiles($dir); > ?> > > Hope you can help me. > Thanks. > > John Holmes wrote: > > > PHPDiscuss - PHP Newsgroups and mailing lists wrote: > > > Hello Professionals, > > > Can anybody help me to open all subdirectories in a directory, > > > I used is_dir() to check whether it is a dir, and if yes, > > > I recursively called it with the new dir name. > > > But all subdirectories are not open the recursion is not working for more > > > than 1 level. > > > I tested it in windows server. > > > Expecting your help, > > > Expecting your code... > > > Have you looked at the opendir manual page to see if there are any > > examples, there? > -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin--

« previous php.general (#193893) next »